[extracted from https://bugs.gentoo.org/663690#c19 ] The breakage (on default i686, ppc, sparc installs): $ LD_LIBRARY_PATH=/usr/lib ld --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o z /usr/lib/Scrt1.o ld: internal error /dev/shm/portage/sys-devel/binutils-2.30/work/binutils-2.30/ld/ldlang.c 6635 It is caused by the fact /usr/lib/libbfd-2.30.0.so comes from sys-libs/binutils-libs (LD_LIBRARY_PATH=/usr/lib) and /usr/lib/binutils/i686-pc-linux-gnu/2.30/libbfd-2.30.0.so have different ABIs. It happens because ./configure options around USE=multitarget and USE=64-bit-bfd change sizes of exported arrays and structs. We have two types of the problem here: 1. /usr/lib/libbfd-2.30.0.so and /usr/lib/binutils/i686-pc-linux-gnu/2.30/libbfd-2.30.0.so have the same SONAME 2. /usr/lib/binutils/i686-pc-linux-gnu/2.30/libbfd-2.30.0.so does not change SONAME when is built with changed USE=64-bit-bfd flag I believe both problems can be fixed by making SONAME more specific. For example: /usr/lib/libopcodes-2.30.0.so can become usr/lib32/libopcodes-2.30.0.gentoo-sys-libs-binutils-libs-mt-def.so /usr/lib/binutils/x86_64-pc-linux-gnu/2.30/libopcodes-2.30.0.so can become /usr/lib/binutils/x86_64-pc-linux-gnu/2.30/libopcodes-2.30.0.gentoo-sys-devel-binutils-mt.so Note: file (and SONAME) contains the following signals: - ${CATEGORY} and ${PN} library comes from (fixes [1.]) - USE=multitarget appens -mt/-st and USE=64-bit-bfd appends -64/-def (fixes [2.])
In order to solve the original problem, it would be sufficient to change sonames of libraries only in sys-devel/binutils. Since libraries of sys-devel/binutils should not be used by any other package, there is no need to make sonames of these libraries more specific than with only one constant addition (e.g. "-binutils" or "-internal"). Example: libbfd-2.31.1.so -> libbfd-binutils-2.31.1.so libopcodes-2.31.1.so -> libopcodes-binutils-2.31.1.so Changing of sonames of libraries in sys-libs/binutils-libs would require rebuild of its reverse dependencies... I think that users are unlikely to often change state of "64-bit-bfd" and "multitarget" USE flags. If any change in sys-libs/binutils-libs at all, then maybe it could be postponed to next version bump (sys-libs/binutils-libs-2.32.0).
Created attachment 546790 [details, diff] 0001-Gentoo-add-with-extra-soversion-suffix-option.patch 0001-Gentoo-add-with-extra-soversion-suffix-option.patch is a patch to inject custom suffixes into SONAME. For above example binutils and binutils-libs modification would look like that: --- a/sys-devel/binutils/binutils-2.30-r3.ebuild +++ b/sys-devel/binutils/binutils-2.30-r3.ebuild @@ -241,6 +241,9 @@ src_configure() { # Strip out broken static link flags. # https://gcc.gnu.org/PR56750 --without-stage1-ldflags + # We pull in all USE-flags that change ABI in incompatible way: + # USE=multitarget change size of global arrays + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) ) echo ./configure "${myconf[@]}" "${S}"/configure "${myconf[@]}" || die --- a/sys-libs/binutils-libs/binutils-libs-2.30-r3.ebuild +++ b/sys-libs/binutils-libs/binutils-libs-2.30-r3.ebuild @@ -78,6 +78,10 @@ multilib_src_configure() { # Strip out broken static link flags. # https://gcc.gnu.org/PR56750 --without-stage1-ldflags + # We pull in all USE-flags that change ABI in incompatible way: + # USE=multitarget change size of global arrays + # USE=64-bit-bfd changes data structures of exported API + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)-$(usex 64-bit-bfd 64 def) ) # mips can't do hash-style=gnu ...
(In reply to Sergei Trofimovich from comment #2) > Created attachment 546790 [details, diff] [details, diff] > 0001-Gentoo-add-with-extra-soversion-suffix-option.patch Pushed to -9999 patchset branch as: https://github.com/gentoo/binutils-gdb/commit/2e1dadb9fcf6f1da021f13da671d67a93a01dee1
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d01953075fcfdb1fbb0e39c3f5f07271e4cf092 commit 5d01953075fcfdb1fbb0e39c3f5f07271e4cf092 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-15 11:26:52 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-15 11:27:17 +0000 sys-devel/binutils: expand SONAME with USE=multitarget, bug #666100 In #663690 creative use of LD_LIBRARY_PATH exposed a problem of Gentoo's split across binutils and binutils-libs: we install libbfd.so with the same SONAME but different ABIs. This caused 'ld' to SIGSEGV or fail asserts. The change here is to give unique SONAME to each of: native binutils, cross binutils, binutils-libs packages. On top of that we encode USE=multitarget flags into SONAME as well. binutils-libs will also include USE=64-bit-bfd. This way dynamic linker will be able to detect incompatible changes like: - rebuild binutils with new USE flags - install binutils-libs (silently overrides binutils' libbfd.so) and report it explicitly. Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.10 sys-devel/binutils/Manifest | 2 +- sys-devel/binutils/binutils-9999.ebuild | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
https://bugs.gentoo.org/666376 is a case of USE=multilib mismatch that breaks amd64. I'll try to push this fix into ~arch by the weekend.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42a2033b9cdf87e13684dba32e70b4366e2fcdbb commit 42a2033b9cdf87e13684dba32e70b4366e2fcdbb Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-20 22:14:39 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-21 07:00:30 +0000 sys-devel/binutils-hppa64: release patchset 3 for 2.31.1 One new patch: + 0014-Gentoo-add-with-extra-soversion-suffix-option.patch Changes SONAME from libopcodes-2.31.1.so to libopcodes-2.31.1.gentoo-sys-devel-binutils-hppa64-st.so SONAME now encodes USE=multilib and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.10 sys-devel/binutils-hppa64/Manifest | 1 + .../binutils-hppa64-2.31.1-r1.ebuild | 396 +++++++++++++++++++++ 2 files changed, 397 insertions(+) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29a5c809380b2a3cb1eb15229404e9cf4dfca61c commit 29a5c809380b2a3cb1eb15229404e9cf4dfca61c Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-20 21:58:33 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-21 07:00:29 +0000 sys-devel/binutils: release patchset 3 for 2.31.1 One new patch: + 0014-Gentoo-add-with-extra-soversion-suffix-option.patch Changes SONAME from libopcodes-2.31.1.so to libopcodes-2.31.1.gentoo-sys-devel-binutils-mt.so SONAME now encodes USE=multilib and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.10 sys-devel/binutils/Manifest | 1 + sys-devel/binutils/binutils-2.31.1-r1.ebuild | 427 +++++++++++++++++++++++++++ 2 files changed, 428 insertions(+) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a15bb52d009b4071e0e3d28b7bba6abad725f8d3 commit a15bb52d009b4071e0e3d28b7bba6abad725f8d3 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-20 21:39:59 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-21 07:00:29 +0000 sys-libs/binutils-libs: release patchset 3 for 2.31.1 One new patch: + 0014-Gentoo-add-with-extra-soversion-suffix-option.patch Changes SONAME from libopcodes-2.31.1.so to libopcodes-2.31.1.gentoo-sys-libs-binutils-libs-mt-def.so SONAME now encodes USE=multilib, USE=64-bit-bfd and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.10 sys-libs/binutils-libs/Manifest | 1 + .../binutils-libs/binutils-libs-2.31.1-r1.ebuild | 112 +++++++++++++++++++++ 2 files changed, 113 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec9a106deef4fc52c5f81a1ef52e18af323f2513 commit ec9a106deef4fc52c5f81a1ef52e18af323f2513 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-25 07:33:26 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-25 07:33:26 +0000 sys-libs/binutils-libs: release patchset 5 for 2.30 One new main patch: + 0098-Gentoo-add-with-extra-soversion-suffix-option.patch And four backports: + 0094-Replace-CET-bit-with-IBT-and-SHSTK-bits.patch + 0095-Fix-parens-in-ld-bootstrap.exp.patch + 0096-x86-64-Clear-the-R_X86_64_converted_reloc_bit-bit.patch + 0097-Fix-unwind-offset-for-call_info-start_symbol.patch Changes SONAME from libopcodes-2.30.so to libopcodes-2.30.gentoo-sys-libs-binutils-libs-mt-def.so SONAME now encodes USE=multilib and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.11 sys-libs/binutils-libs/Manifest | 1 + .../binutils-libs/binutils-libs-2.30-r4.ebuild | 112 +++++++++++++++++++++ 2 files changed, 113 insertions(+) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7764cb4e0cf79ec433f488a7cc76f0f9da34285 commit f7764cb4e0cf79ec433f488a7cc76f0f9da34285 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-25 07:32:10 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-25 07:32:10 +0000 sys-devel/binutils-hppa64: release patchset 5 for 2.30 One new main patch: + 0098-Gentoo-add-with-extra-soversion-suffix-option.patch And four backports: + 0094-Replace-CET-bit-with-IBT-and-SHSTK-bits.patch + 0095-Fix-parens-in-ld-bootstrap.exp.patch + 0096-x86-64-Clear-the-R_X86_64_converted_reloc_bit-bit.patch + 0097-Fix-unwind-offset-for-call_info-start_symbol.patch Changes SONAME from libopcodes-2.30.so to libopcodes-2.30.gentoo-sys-devel-binutils-hppa64-st.so SONAME now encodes USE=multilib and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.11 sys-devel/binutils-hppa64/Manifest | 1 + .../binutils-hppa64/binutils-hppa64-2.30-r4.ebuild | 396 +++++++++++++++++++++ 2 files changed, 397 insertions(+) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8b0a8d7bb07bd2a7c4bd33a9e9598051030823a commit d8b0a8d7bb07bd2a7c4bd33a9e9598051030823a Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-09-25 07:30:30 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-09-25 07:30:30 +0000 sys-devel/binutils: release patchset 5 for 2.30 One new main patch: + 0098-Gentoo-add-with-extra-soversion-suffix-option.patch And four backports: + 0094-Replace-CET-bit-with-IBT-and-SHSTK-bits.patch + 0095-Fix-parens-in-ld-bootstrap.exp.patch + 0096-x86-64-Clear-the-R_X86_64_converted_reloc_bit-bit.patch + 0097-Fix-unwind-offset-for-call_info-start_symbol.patch Changes SONAME from libopcodes-2.30.so to libopcodes-2.30.gentoo-sys-devel-binutils-mt.so SONAME now encodes USE=multilib and package name. Bug: https://bugs.gentoo.org/663690 Bug: https://bugs.gentoo.org/666376 Bug: https://bugs.gentoo.org/666100 Package-Manager: Portage-2.3.49, Repoman-2.3.11 sys-devel/binutils/Manifest | 1 + sys-devel/binutils/binutils-2.30-r4.ebuild | 419 +++++++++++++++++++++++++++++ 2 files changed, 420 insertions(+)
*** Bug 645222 has been marked as a duplicate of this bug. ***
*** Bug 666376 has been marked as a duplicate of this bug. ***
*** Bug 666686 has been marked as a duplicate of this bug. ***
*** Bug 634620 has been marked as a duplicate of this bug. ***
Do the soname's have to be in sync with the hosts binutils when building a cross compiler? And do they have to be in sync again when cross-emerging a binutils for the given prefix=/usr/armv7a-unknown-linux-gnueabihf? The latter in my case of course.
(In reply to tt_1 from comment #12) > Do the soname's have to be in sync with the hosts binutils when building a > cross compiler? And do they have to be in sync again when cross-emerging a > binutils for the given prefix=/usr/armv7a-unknown-linux-gnueabihf? The > latter in my case of course. I don't understand the question. Sonames of what exact package names and built by which toolchain?
this is the one time that DT_RPATH matters over DT_RUNPATH. DT_RPATH is searched before LD_LIBRARY_PATH. so if we forced binutils to link with -Wl,--disable-new-dtags, we probably wouldn't need these soname hacks.