Сравнение binutils-2.43-r2 с binutils-2.45.1

/usr/portage/sys-devel/binutils/binutils-2.45.1.ebuild 2025-12-11 18:18:04.711773667 +0300
1 1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
6
inherit dot-a libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
7 7

  
8 8
DESCRIPTION="Tools necessary to build programs"
9 9
HOMEPAGE="https://sourceware.org/binutils/"
10 10

  
11 11
LICENSE="GPL-3+"
12
IUSE="cet debuginfod doc gold gprofng hardened multitarget +nls pgo +plugins static-libs test vanilla zstd"
12
IUSE="cet debuginfod doc gprofng hardened multitarget +nls pgo +plugins static-libs test vanilla xxhash zstd"
13 13

  
14 14
# Variables that can be set here  (ignored for live ebuilds)
15 15
# PATCH_VER          - the patchset version
......
19 19
# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
20 20
#                      for the patchsets
21 21

  
22
PATCH_VER=3
23
PATCH_DEV=dilfridge
22
PATCH_VER=1
23
PATCH_DEV=sam
24 24

  
25 25
if [[ ${PV} == 9999 ]]; then
26 26
	inherit git-r3
......
60 60
	)
61 61
	zstd? ( app-arch/zstd:= )
62 62
"
63
DEPEND="${RDEPEND}"
63
DEPEND="
64
	${RDEPEND}
65
	xxhash? ( dev-libs/xxhash )
66
"
64 67
BDEPEND="
65 68
	doc? ( sys-apps/texinfo )
66 69
	pgo? (
......
83 86

  
84 87
src_unpack() {
85 88
	if [[ ${PV} == *9999 ]] ; then
86
		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
89
		EGIT_REPO_URI="
90
			https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git
91
			https://github.com/gentoo/binutils-patches
92
		"
87 93
		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
88 94
		git-r3_src_unpack
89 95
		mv patches-git/9999 patch || die
......
91 97
		if [[ ${PV} != 9999 ]] ; then
92 98
			EGIT_BRANCH=binutils-$(ver_cut 1)_$(ver_cut 2)-branch
93 99
		fi
94
		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
100
		EGIT_REPO_URI="
101
			https://sourceware.org/git/binutils-gdb.git
102
			https://git.sr.ht/~sourceware/binutils-gdb
103
			https://gitlab.com/x86-binutils/binutils-gdb.git
104
		"
95 105
		S=${WORKDIR}/binutils
96 106
		EGIT_CHECKOUT_DIR=${S}
97 107
		git-r3_src_unpack
......
132 142
			# It should be okay on non-prefix systems though. See bug #892549.
133 143
			if is_cross || use prefix; then
134 144
				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
135
					"${FILESDIR}"/binutils-2.41-linker-prefix.patch
145
					   "${FILESDIR}"/binutils-2.43-linker-prefix.patch
136 146
			fi
137 147
		fi
138 148
	fi
......
184 194
	strip-flags
185 195
	use cet && filter-flags -mindirect-branch -mindirect-branch=*
186 196
	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
187

  
188
	# https://sourceware.org/PR32372
189
	append-cflags $(test-flags-CC -std=gnu17)
197
	lto-guarantee-fat
190 198

  
191 199
	local x
192 200
	echo
......
201 209
	if use plugins ; then
202 210
		myconf+=( --enable-plugins )
203 211
	fi
204
	# enable gold (installed as ld.gold) and ld's plugin architecture
205
	if use gold ; then
206
		myconf+=( --enable-gold )
207
	fi
208 212

  
209 213
	if use nls ; then
210 214
		myconf+=( --without-included-gettext )
......
269 273
		--with-bugurl="$(toolchain-binutils_bugurl)"
270 274
		--with-pkgversion="$(toolchain-binutils_pkgversion)"
271 275
		$(use_enable static-libs static)
276
		$(use_with xxhash)
272 277
		$(use_with zstd)
273 278

  
274 279
		# Disable modules that are in a combined binutils/gdb tree, bug #490566
......
290 295

  
291 296
		# We can enable this by default in future, but it's brand new
292 297
		# in 2.39 with several bugs:
293
		# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
294
		# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
295
		# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
298
		# - Doesn't build on musl (https://sourceware.org/PR29477)
299
		# - No man pages (https://sourceware.org/PR29521)
300
		# - Broken at runtime without Java (https://sourceware.org/PR29479)
296 301
		# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
297 302
		$(use_enable gprofng)
303

  
304
		# Enables colored disassembly by default (equivalent to passing
305
		# --disassembler-color=terminal to all objdump invocations).
306
		--enable-colored-disassembly
298 307
	)
299 308

  
300 309
	case ${CTARGET} in
......
302 311
			# These hardening options are available from 2.39+ but
303 312
			# they unconditionally enable the behaviour even on arches
304 313
			# where e.g. execstacks can't be avoided.
305
			# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
314
			# See https://sourceware.org/PR29592.
306 315
			#
307 316
			# TODO: Get the logic for this fixed upstream so it doesn't
308 317
			# create impossible broken combinations on some arches, like mips.
......
349 358
			# with the testsuite.
350 359
			filter-lto
351 360

  
361
			# bug #637066
362
			filter-flags -Wall -Wreturn-type
363

  
352 364
			export BUILD_CFLAGS="${CFLAGS}"
353 365
		fi
354 366
	fi
......
390 402
		# Tests don't expect LTO
391 403
		filter-lto
392 404

  
405
		# If we have e.g. -mfpmath=sse -march=pentium4 in CFLAGS,
406
		# we'll get lto1 warnings for some tests which cause
407
		# spurious failures because -mfpmath isn't passed at
408
		# link-time. Filter accordingly.
409
		#
410
		# Alternatively, we could pass C{C,XX}_FOR_TARGET with
411
		# some (ideally not all, surely would break some tests)
412
		# stuffed in.
413
		filter-flags '-mfpmath=*'
414

  
393 415
		# lto-wrapper warnings which confuse tests
394 416
		filter-flags '-Wa,*'
395 417

  
......
415 437
	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
416 438
	rm -rf "${ED}"/${LIBPATH}/bin || die
417 439
	use static-libs || find "${ED}" -name '*.la' -delete
440
	# Explicit "${ED}" as we need it to do things even w/ USE=-static-libs
441
	strip-lto-bytecode "${ED}"
418 442

  
419 443
	# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
420 444
	cd "${ED}"/${LIBPATH} || die
......
502 526
	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
503 527
}
504 528

  
529
# Simple test to make sure our new binutils isn't completely broken.
530
# Skip if this binutils is a cross compiler.
531
binutils_sanity_check() {
532
	pushd "${T}" >/dev/null
533

  
534
	einfo "Last-minute run tests with binutils in ${ED}${BINPATH} ..."
535

  
536
	cat <<-EOF > "${T}"/number.c
537
	int get_magic_number() {
538
		return 42;
539
	}
540
	EOF
541

  
542
	cat <<-EOF > "${T}"/test.c
543
	#include <stdio.h>
544
	int get_magic_number();
545

  
546
	int main() {
547
		printf("Hello Gentoo! Your magic number is: %d\n", get_magic_number());
548
	}
549
	EOF
550

  
551
	local -x LD_LIBRARY_PATH="${ED}${LIBPATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
552

  
553
	local opt opt2
554
	# TODO: test multilib variants?
555
	for opt in '' '-O2' ; do
556
		# TODO: add static-pie? we need to check if support exists, though (bug #965478)
557
		for opt2 in '-static' '-fno-PIE -no-pie' ; do
558
			$(tc-getCC) ${opt} ${opt2} -B"${ED}${BINPATH}" "${T}"/number.c "${T}"/test.c -o "${T}"/test
559
			if "${T}"/test | grep -q "Hello Gentoo! Your magic number is: 42" ; then
560
				:;
561
			else
562
				die "Test with '${opt} ${opt2}' failed! Aborting to avoid broken binutils!"
563
			fi
564
		done
565
	done
566

  
567
	popd >/dev/null
568
}
569

  
570
pkg_preinst() {
571
	[[ -n ${ROOT} ]] && return 0
572
	[[ -n ${EPREFIX} ]] && return 0
573
	[[ -d ${ED}${BINPATH} ]] || return 0
574
	[[ -n ${BOOTSTRAP_RAP} ]] || return 0
575
	is_cross && return 0
576
	binutils_sanity_check
577
}
578

  
505 579
pkg_postinst() {
506 580
	# Make sure this ${CTARGET} has a binutils version selected
507 581
	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
Спасибо!