From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 21CEF15800F for ; Wed, 22 Feb 2023 22:26:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 189A9E0391; Wed, 22 Feb 2023 22:26:37 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E3F2CE0391 for ; Wed, 22 Feb 2023 22:26:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0C36E3409C8 for ; Wed, 22 Feb 2023 22:26:36 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 52DE175 for ; Wed, 22 Feb 2023 22:26:34 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1677104782.07d598347c2a311c91eacd4303e0517cf0a127c3.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/files/, sys-devel/binutils/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/binutils/binutils-2.40-r2.ebuild sys-devel/binutils/binutils-9999.ebuild sys-devel/binutils/files/binutils-2.40-linker-search-path.patch X-VCS-Directories: sys-devel/binutils/files/ sys-devel/binutils/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 07d598347c2a311c91eacd4303e0517cf0a127c3 X-VCS-Branch: master Date: Wed, 22 Feb 2023 22:26:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d5f8ff3b-2368-4ebf-95e9-cc91171f6870 X-Archives-Hash: 8370c3d644b060f1afce5b2ddc624340 commit: 07d598347c2a311c91eacd4303e0517cf0a127c3 Author: Sam James gentoo org> AuthorDate: Wed Feb 22 22:22:46 2023 +0000 Commit: Sam James gentoo org> CommitDate: Wed Feb 22 22:26:22 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07d59834 sys-devel/binutils: apply linker search path fixes from Chewi for prefix Quoting Chewi on the PR for posterity: """ The first of these changes fixes two related issues with prefixed and crossdev environments. The prefix issue is detailed in Gentoo bug #892549. The crossdev issue can be reproduced by trying something like: USE="-python icu" aarch64-unknown-linux-gnu-emerge libxml2 The second of these changes is not essential, but it does make bfd's behaviour in this area more consistent with the other linkers, which have not experienced these issues at all. I'm not sure what upstream will make of these changes, particularly the second one, but it is interesting that even gold does not behave the same way as bfd here. Perhaps we can give them some exposure in Gentoo for a while before seeing what they think. The second change would not be submitted upstream as-is because fully removing the ld.so.conf feature is a much bigger diff. """ This patch is, for now, only applied for prefix. It should be safe on other systems but the issue is more pressing on prefix given a recent migration. Bug: https://bugs.gentoo.org/892549 Thanks-to: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> ...inutils-9999.ebuild => binutils-2.40-r2.ebuild} | 12 ++-- sys-devel/binutils/binutils-9999.ebuild | 12 ++-- .../files/binutils-2.40-linker-search-path.patch | 74 ++++++++++++++++++++++ 3 files changed, 88 insertions(+), 10 deletions(-) diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-2.40-r2.ebuild similarity index 96% copy from sys-devel/binutils/binutils-9999.ebuild copy to sys-devel/binutils/binutils-2.40-r2.ebuild index c8e0d5f94944..d8c2553ece20 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-2.40-r2.ebuild @@ -19,7 +19,7 @@ IUSE="cet doc gold gprofng multitarget +nls pgo +plugins static-libs test vanill # PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... # for the patchsets -PATCH_VER=0 +PATCH_VER=2 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then @@ -28,11 +28,11 @@ if [[ ${PV} == 9999* ]]; then else PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} PATCH_DEV=${PATCH_DEV:-dilfridge} - SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" SLOT=$(ver_cut 1-2) - #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" fi # @@ -112,6 +112,10 @@ src_prepare() { einfo "Applying binutils patchset ${patchsetname}" eapply "${WORKDIR}/patch" einfo "Done." + + # This is applied conditionally for now just out of caution. + # It should be okay on non-prefix systems though. See bug #892549. + use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch fi fi @@ -181,8 +185,6 @@ src_configure() { append-ldflags -Wl,--undefined-version fi - use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 - local x echo for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild index c8e0d5f94944..d8c2553ece20 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-9999.ebuild @@ -19,7 +19,7 @@ IUSE="cet doc gold gprofng multitarget +nls pgo +plugins static-libs test vanill # PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... # for the patchsets -PATCH_VER=0 +PATCH_VER=2 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then @@ -28,11 +28,11 @@ if [[ ${PV} == 9999* ]]; then else PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} PATCH_DEV=${PATCH_DEV:-dilfridge} - SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" SLOT=$(ver_cut 1-2) - #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" fi # @@ -112,6 +112,10 @@ src_prepare() { einfo "Applying binutils patchset ${patchsetname}" eapply "${WORKDIR}/patch" einfo "Done." + + # This is applied conditionally for now just out of caution. + # It should be okay on non-prefix systems though. See bug #892549. + use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch fi fi @@ -181,8 +185,6 @@ src_configure() { append-ldflags -Wl,--undefined-version fi - use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 - local x echo for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do diff --git a/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch new file mode 100644 index 000000000000..7423f8d70556 --- /dev/null +++ b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch @@ -0,0 +1,74 @@ +https://bugs.gentoo.org/892549 +https://github.com/gentoo/binutils-gdb/pull/4 + +From 1601840f9f2397edd56177871527a198a14277bd Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Sat, 11 Feb 2023 15:15:20 +0000 +Subject: [PATCH 1/2] ldelf.c: Always consider -L arguments when handling + DT_NEEDED + +This is for consistency with other linkers, including gold. Without +this, we typically rely on ld.so.conf to find libraries such as +libstdc++.so.6, while other linkers do not use this file at all. +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1090,8 +1090,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + linker will search. That means that we want to use + rpath_link, rpath, then the environment variable + LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH +- entries (native only), then the linker script LIB_SEARCH_DIRS. +- We do not search using the -L arguments. ++ entries (native only), then the linker script LIB_SEARCH_DIRS, ++ then the -L arguments. + + We search twice. The first time, we skip objects which may + introduce version mismatches. The second time, we force +@@ -1165,11 +1165,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + len = strlen (l->name); + for (search = search_head; search != NULL; search = search->next) + { +- char *filename; +- +- if (search->cmdline) +- continue; +- filename = (char *) xmalloc (strlen (search->name) + len + 2); ++ char *filename = (char *) xmalloc (strlen (search->name) + len + 2); + sprintf (filename, "%s/%s", search->name, l->name); + nn.name = filename; + if (ldelf_try_needed (&nn, force, is_linux)) + +From 8afc65c8d8c0fff2f686ddd8eb9023c7ebabcca9 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Sat, 11 Feb 2023 15:18:58 +0000 +Subject: [PATCH 2/2] ldelf.c: Do not search for libraries using ld.so.conf + +Other linkers do not do this. It is problematic for Gentoo Linux, +because crossdev installs libraries such as libstdc++.so.6 outside of +the sysroot. +--- a/ld/ld.texi ++++ b/ld/ld.texi +@@ -2355,7 +2355,9 @@ For a linker for a Linux system, if the file @file{/etc/ld.so.conf} + exists, the list of directories found in that file. Note: the path + to this file is prefixed with the @code{sysroot} value, if that is + defined, and then any @code{prefix} string if the linker was +-configured with the @command{--prefix=} option. ++configured with the @command{--prefix=} option. This has feature has ++been disabled on Gentoo Linux to make it consistent with the other ++linkers, which do not do this. + @item + For a native linker on a FreeBSD system, any directories specified by + the @code{_PATH_ELF_HINTS} macro defined in the @file{elf-hints.h} +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1156,10 +1156,6 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + if (is_freebsd + && ldelf_check_ld_elf_hints (l, force, elfsize)) + break; +- +- if (is_linux +- && ldelf_check_ld_so_conf (l, force, elfsize, prefix)) +- break; + } + + len = strlen (l->name); +