public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/util/_dyn_libs/, bin/
@ 2020-05-24 22:18 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2020-05-24 22:18 UTC (permalink / raw
  To: gentoo-commits

commit:     0bd5b693ef12c266000aafeb9557c1437fdfc1b2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May  9 22:07:17 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 24 22:15:24 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0bd5b693

NeededEntry: don't use scanelf -q (bug 721336)

We don't use scanelf -q, since that would omit libraries like
musl's /usr/lib/libc.so which do not have any DT_NEEDED or
DT_SONAME settings. Since we don't use scanelf -q, we have to
handle the special rpath value "  -  ".

Bug: https://bugs.gentoo.org/721336
Fixes: 25fbe7bc1a92 ("NeededEntry: infer implicit soname from file basename (bug 715162)")
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/misc-functions.sh                       | 6 +++++-
 lib/portage/util/_dyn_libs/LinkageMapELF.py | 5 ++++-
 lib/portage/util/_dyn_libs/NeededEntry.py   | 5 +++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 9efe99b87..c2a16cbe0 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -177,7 +177,11 @@ install_qa_check() {
 	if type -P scanelf > /dev/null ; then
 		# Save NEEDED information after removing self-contained providers
 		rm -f "$PORTAGE_BUILDDIR"/build-info/NEEDED{,.ELF.2}
-		scanelf -qyRF '%a;%p;%S;%r;%n' "${D%/}/" | { while IFS= read -r l; do
+		# We don't use scanelf -q, since that would omit libraries like
+		# musl's /usr/lib/libc.so which do not have any DT_NEEDED or
+		# DT_SONAME settings. Since we don't use scanelf -q, we have to
+		# handle the special rpath value "  -  " below.
+		scanelf -yRBF '%a;%p;%S;%r;%n' "${D%/}/" | { while IFS= read -r l; do
 			arch=${l%%;*}; l=${l#*;}
 			obj="/${l%%;*}"; l=${l#*;}
 			soname=${l%%;*}; l=${l#*;}

diff --git a/lib/portage/util/_dyn_libs/LinkageMapELF.py b/lib/portage/util/_dyn_libs/LinkageMapELF.py
index 2d4929445..473a1243d 100644
--- a/lib/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/lib/portage/util/_dyn_libs/LinkageMapELF.py
@@ -272,7 +272,10 @@ class LinkageMapELF(object):
 					continue
 				plibs.update((x, cpv) for x in items)
 		if plibs:
-			args = [os.path.join(EPREFIX or "/", "usr/bin/scanelf"), "-qF", "%a;%F;%S;%r;%n"]
+			# We don't use scanelf -q, since that would omit libraries like
+			# musl's /usr/lib/libc.so which do not have any DT_NEEDED or
+			# DT_SONAME settings.
+			args = [os.path.join(EPREFIX or "/", "usr/bin/scanelf"), "-BF", "%a;%F;%S;%r;%n"]
 			args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
 				for x in plibs)
 			try:

diff --git a/lib/portage/util/_dyn_libs/NeededEntry.py b/lib/portage/util/_dyn_libs/NeededEntry.py
index c52cfce3c..70ff99100 100644
--- a/lib/portage/util/_dyn_libs/NeededEntry.py
+++ b/lib/portage/util/_dyn_libs/NeededEntry.py
@@ -52,6 +52,11 @@ class NeededEntry(object):
 
 		del fields[cls._MIN_FIELDS:]
 		obj.arch, obj.filename, obj.soname, rpaths, needed = fields
+		# We don't use scanelf -q, since that would omit libraries like
+		# musl's /usr/lib/libc.so which do not have any DT_NEEDED or
+		# DT_SONAME settings. Since we don't use scanelf -q, we have to
+		# handle the special rpath value "  -  " below.
+		rpaths = "" if rpaths == "  -  " else rpaths
 		obj.runpaths = tuple(filter(None, rpaths.split(":")))
 		obj.needed = tuple(filter(None, needed.split(",")))
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-24 22:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-24 22:18 [gentoo-commits] proj/portage:master commit in: lib/portage/util/_dyn_libs/, bin/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox