Diff glibc-2.35-r11 with a glibc-2.36-r8

/usr/portage/sys-libs/glibc/glibc-2.36-r8.ebuild 2023-10-09 14:52:35.544368503 +0300
20 20
EMULTILIB_PKG="true"
21 21

  
22 22
# Gentoo patchset (ignored for live ebuilds)
23
PATCH_VER=12
23
PATCH_VER=10
24 24
PATCH_DEV=dilfridge
25 25

  
26 26
if [[ ${PV} == 9999* ]]; then
......
29 29
	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
30 30
	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
31 31
	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
32
	SRC_URI+=" experimental-loong? ( https://dev.gentoo.org/~xen0n/distfiles/glibc-2.35-loongarch-patches-20220522.tar.xz )"
33 32
fi
34 33

  
35 34
RELEASE_VER=${PV}
36 35

  
37 36
GCC_BOOTSTRAP_VER=20201208
38 37

  
39
LOCALE_GEN_VER=2.22
38
LOCALE_GEN_VER=2.23
40 39

  
41 40
GLIBC_SYSTEMD_VER=20210729
42 41

  
......
44 43
SRC_URI+=" multilib-bootstrap? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
45 44
SRC_URI+=" systemd? ( https://gitweb.gentoo.org/proj/toolchain/glibc-systemd.git/snapshot/glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz )"
46 45

  
47
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"
46
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"
48 47

  
49 48
# Minimum kernel version that glibc requires
50 49
MIN_KERN_VER="3.2.0"
......
112 111
		sys-apps/grep
113 112
		app-alternatives/awk
114 113
	)
114
	test? ( dev-lang/perl )
115 115
"
116 116
COMMON_DEPEND="
117 117
	gd? ( media-libs/gd:2= )
......
119 119
		audit? ( sys-process/audit )
120 120
		caps? ( sys-libs/libcap )
121 121
	) )
122
	perl? ( dev-lang/perl )
123
	test? ( dev-lang/perl )
122 124
	suid? ( caps? ( sys-libs/libcap ) )
123 125
	selinux? ( sys-libs/libselinux )
124 126
	systemtap? ( dev-util/systemtap )
......
337 339
				use stack-realign && export CFLAGS_x86+=" -mstackrealign"
338 340

  
339 341
				# Workaround for bug #823780.
342
				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
343
				CC_mangled=${CC}
344
				CC=${glibc__GLIBC_CC}
340 345
				if tc-is-gcc && (($(gcc-major-version) == 11)) && (($(gcc-minor-version) <= 2)) && (($(gcc-micro-version) == 0)) ; then
341 346
					export CFLAGS_x86="${CFLAGS_x86} -mno-avx512f"
342 347
					einfo "Auto adding -mno-avx512f to CFLAGS_x86 for buggy GCC version (bug #823780) (ABI=${ABI})"
343 348
				fi
349
				CC=${CC_mangled}
344 350
			fi
345 351
		;;
346 352
		mips)
......
428 434
	# https://sourceware.org/PR27837
429 435
	filter-ldflags '-Wl,--relax'
430 436

  
437
	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
438
	# we have to do that here already so mips can filter it out again :P
439
	if use hash-sysv-compat ; then
440
		append-ldflags '-Wl,--hash-style=both'
441
	fi
442

  
431 443
	# #492892
432 444
	filter-flags -frecord-gcc-switches
433 445

  
446
	# #898098
447
	filter-flags -fno-builtin
448

  
434 449
	# #829583
435 450
	filter-lfs-flags
436 451

  
......
450 465
	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
451 466
	replace-flags -O0 -O1
452 467

  
468
	# glibc handles this internally already where it's appropriate;
469
	# can't always have SSP when we're the ones setting it up, etc
453 470
	filter-flags '-fstack-protector*'
454 471

  
472
	# Similar issues as with SSP. Can't inject yourself that early.
473
	filter-flags '-fsanitize=*'
474

  
455 475
	# See end of bug #830454; we handle this via USE=cet
456
	filter-flags '-fcf-protection='
476
	filter-flags '-fcf-protection=*'
477

  
478
	# When bootstrapping, we may have a situation where
479
	# CET-enabled gcc from seed is used to build CET-disabled
480
	# glibc. As such, gcc implicitly enables CET if no
481
	# -fcf-protection flag is passed. For a typical package it
482
	# should not be a problem, but for glibc it matters as it is
483
	# dealing with CET in ld.so. So if CET is supposed to be
484
	# disabled for glibc, be explicit about it.
485
	if (use amd64 || use x86) && ! use cet; then
486
		append-flags '-fcf-protection=none'
487
	fi
457 488
}
458 489

  
459 490
use_multiarch() {
......
522 553
	fi
523 554

  
524 555
	# Reset CC and CXX to the value at start of emerge
525
	export CC=${__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
526
	export CXX=${__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
556
	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
557
	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
527 558

  
528
	# and make sure __ORIC_CC and __ORIG_CXX is defined now.
529
	export __ORIG_CC=${CC}
530
	export __ORIG_CXX=${CXX}
559
	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
560
	export glibc__ORIG_CC=${CC}
561
	export glibc__ORIG_CXX=${CXX}
531 562

  
532 563
	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
533 564
		export glibc__force_gcc=yes
......
590 621
	# around the original clean value to avoid appending multiple ABIs on
591 622
	# top of each other. (Why does the comment talk about CFLAGS if the code
592 623
	# acts on CC?)
593
	export __GLIBC_CC=${CC}
594
	export __GLIBC_CXX=${CXX}
624
	export glibc__GLIBC_CC=${CC}
625
	export glibc__GLIBC_CXX=${CXX}
595 626

  
596
	export __abi_CFLAGS="$(get_abi_CFLAGS)"
627
	export glibc__abi_CFLAGS="$(get_abi_CFLAGS)"
597 628

  
598 629
	# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
599 630
	# To build .S (assembly) files with the same ABI-specific flags
......
602 633
	# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
603 634
	# and breaks multiarch support. See 659030#c3 for an example.
604 635
	# The glibc configure script doesn't properly use LDFLAGS all the time.
605
	export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
636
	export CC="${glibc__GLIBC_CC} ${glibc__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
606 637

  
607 638
	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
608
	export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
639
	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
609 640

  
610 641
	if is_crosscompile; then
611 642
		# Assume worst-case bootstrap: glibc is buil first time
......
807 838
				fi
808 839
			fi
809 840

  
810
			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
811
			if ! eend_KV ${build_kv} ${want_kv} ; then
812
				echo
813
				eerror "You need linux-headers of at least ${want_kv}!"
814
				die "linux-headers version too low!"
841
			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
842
			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
843
			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
844
			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
845
			# need to run this check at all given we have a dependency on the right headers,
846
			# but let's leave it as-is for now.
847
			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
848
				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
849
				if ! eend_KV ${build_kv} ${want_kv} ; then
850
					echo
851
					eerror "You need linux-headers of at least ${want_kv}!"
852
					die "linux-headers version too low!"
853
				fi
815 854
			fi
816 855
		fi
817 856
	fi
......
871 910

  
872 911
		cd "${WORKDIR}" || die
873 912
		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
874
		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220522.tar.xz
875 913
	fi
876 914

  
877 915
	cd "${WORKDIR}" || die
......
890 928
		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
891 929
		eapply "${WORKDIR}"/patches
892 930
		einfo "Done."
893

  
894
		if use experimental-loong ; then
895
			einfo "Applying experimental LoongArch patchset"
896
			eapply "${WORKDIR}"/loongarch-2.35
897
			einfo "Done."
898
		fi
899
	fi
900

  
901
	eapply "${FILESDIR}"/2.35/glibc-2.35-make-4.4-MAKEFLAGS.patch
902

  
903
	if use clone3 ; then
904
		append-cppflags -DGENTOO_USE_CLONE3
905
	else
906
		# See e.g. bug #827386, bug #819045.
907
		elog "Disabling the clone3 syscall for compatibility with older Electron apps."
908
		elog "Please re-enable this flag before filing bugs!"
909 931
	fi
910 932

  
911 933
	default
......
1005 1027
		$(use_enable systemtap)
1006 1028
		$(use_enable nscd)
1007 1029

  
1030
		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
1031
		# Perl hasn't been installed inside the prefix yet and configure picks
1032
		# up a Perl from outside the prefix instead. configure will fail to
1033
		# execute Perl during configure if we're cross-compiling a prefix, but
1034
		# it will just disable mtrace in that case.
1035
		# Note: mtrace is needed by the test suite.
1036
		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
1037

  
1008 1038
		# locale data is arch-independent
1009 1039
		# https://bugs.gentoo.org/753740
1010 1040
		libc_cv_complocaledir='${exec_prefix}/lib/locale'
......
1302 1332
		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
1303 1333
	fi
1304 1334

  
1335
	# We configure toolchains for standalone prefix systems with a sysroot,
1336
	# which is prepended to paths in ld scripts, so strip the prefix from these.
1337
	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
1338
	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
1339
	if [[ -n $(host_eprefix) ]] ; then
1340
		local file
1341
		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
1342
			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
1343
		done
1344
	fi
1345

  
1305 1346
	# We'll take care of the cache ourselves
1306 1347
	rm -f "${ED}"/etc/ld.so.cache
1307 1348

  
Thank you!