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

/usr/portage/sys-libs/glibc/glibc-2.36-r8.ebuild 2024-12-25 14:59:52.815270184 +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 ~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-debug/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)
......
433 439
	# adaptation. Mentioned in PR21557#c0.
434 440
	filter-ldflags '-Wl,--gc-sections'
435 441

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

  
436 448
	# #492892
437 449
	filter-flags -frecord-gcc-switches
438 450

  
451
	# #898098
452
	filter-flags -fno-builtin
453

  
439 454
	# #829583
440 455
	filter-lfs-flags
441 456

  
......
455 470
	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
456 471
	replace-flags -O0 -O1
457 472

  
473
	# glibc handles this internally already where it's appropriate;
474
	# can't always have SSP when we're the ones setting it up, etc
458 475
	filter-flags '-fstack-protector*'
459 476

  
477
	# Similar issues as with SSP. Can't inject yourself that early.
478
	filter-flags '-fsanitize=*'
479

  
460 480
	# See end of bug #830454; we handle this via USE=cet
461
	filter-flags '-fcf-protection='
481
	filter-flags '-fcf-protection=*'
482

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

  
464 495
use_multiarch() {
......
529 560
	fi
530 561

  
531 562
	# Reset CC and CXX to the value at start of emerge
532
	export CC=${__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
533
	export CXX=${__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
563
	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
564
	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
534 565

  
535
	# and make sure __ORIC_CC and __ORIG_CXX is defined now.
536
	export __ORIG_CC=${CC}
537
	export __ORIG_CXX=${CXX}
566
	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
567
	export glibc__ORIG_CC=${CC}
568
	export glibc__ORIG_CXX=${CXX}
538 569

  
539 570
	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
540 571
		export glibc__force_gcc=yes
......
597 628
	# around the original clean value to avoid appending multiple ABIs on
598 629
	# top of each other. (Why does the comment talk about CFLAGS if the code
599 630
	# acts on CC?)
600
	export __GLIBC_CC=${CC}
601
	export __GLIBC_CXX=${CXX}
631
	export glibc__GLIBC_CC=${CC}
632
	export glibc__GLIBC_CXX=${CXX}
602 633

  
603
	export __abi_CFLAGS="$(get_abi_CFLAGS)"
634
	export glibc__abi_CFLAGS="$(get_abi_CFLAGS)"
604 635

  
605 636
	# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
606 637
	# To build .S (assembly) files with the same ABI-specific flags
......
609 640
	# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
610 641
	# and breaks multiarch support. See 659030#c3 for an example.
611 642
	# The glibc configure script doesn't properly use LDFLAGS all the time.
612
	export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
643
	export CC="${glibc__GLIBC_CC} ${glibc__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
613 644

  
614 645
	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
615
	export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
646
	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
616 647

  
617 648
	if is_crosscompile; then
618 649
		# Assume worst-case bootstrap: glibc is buil first time
......
818 849
				fi
819 850
			fi
820 851

  
821
			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
822
			if ! eend_KV ${build_kv} ${want_kv} ; then
823
				echo
824
				eerror "You need linux-headers of at least ${want_kv}!"
825
				die "linux-headers version too low!"
852
			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
853
			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
854
			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
855
			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
856
			# need to run this check at all given we have a dependency on the right headers,
857
			# but let's leave it as-is for now.
858
			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
859
				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
860
				if ! eend_KV ${build_kv} ${want_kv} ; then
861
					echo
862
					eerror "You need linux-headers of at least ${want_kv}!"
863
					die "linux-headers version too low!"
864
				fi
826 865
			fi
827 866
		fi
828 867
	fi
......
882 921

  
883 922
		cd "${WORKDIR}" || die
884 923
		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
885
		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220522.tar.xz
886 924
	fi
887 925

  
888 926
	cd "${WORKDIR}" || die
......
901 939
		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
902 940
		eapply "${WORKDIR}"/patches
903 941
		einfo "Done."
904

  
905
		if use experimental-loong ; then
906
			einfo "Applying experimental LoongArch patchset"
907
			eapply "${WORKDIR}"/loongarch-2.35
908
			einfo "Done."
909
		fi
910
	fi
911

  
912
	eapply "${FILESDIR}"/2.35/glibc-2.35-make-4.4-MAKEFLAGS.patch
913

  
914
	if use clone3 ; then
915
		append-cppflags -DGENTOO_USE_CLONE3
916
	else
917
		# See e.g. bug #827386, bug #819045.
918
		elog "Disabling the clone3 syscall for compatibility with older Electron apps."
919
		elog "Please re-enable this flag before filing bugs!"
920 942
	fi
921 943

  
922 944
	default
......
1016 1038
		$(use_enable systemtap)
1017 1039
		$(use_enable nscd)
1018 1040

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

  
1019 1049
		# locale data is arch-independent
1020 1050
		# https://bugs.gentoo.org/753740
1021 1051
		libc_cv_complocaledir='${exec_prefix}/lib/locale'
......
1313 1343
		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
1314 1344
	fi
1315 1345

  
1346
	# We configure toolchains for standalone prefix systems with a sysroot,
1347
	# which is prepended to paths in ld scripts, so strip the prefix from these.
1348
	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
1349
	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
1350
	if [[ -n $(host_eprefix) ]] ; then
1351
		local file
1352
		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
1353
			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
1354
		done
1355
	fi
1356

  
1316 1357
	# We'll take care of the cache ourselves
1317 1358
	rm -f "${ED}"/etc/ld.so.cache
1318 1359

  
Thank you!