From e110a56c2c1c8dc33bc48509392a910d074b8481 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Fri, 10 May 2019 03:20:14 +0200 Subject: [PATCH] bin/install-qa-check.d: 80libraries: Do not report libraries missing DT_NEEDED and not containing undefined non-weak symbols. Bug: https://bugs.gentoo.org/516016 Signed-off-by: Arfrever Frehtes Taifersar Arahesis --- bin/install-qa-check.d/80libraries | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/install-qa-check.d/80libraries b/bin/install-qa-check.d/80libraries index bbabc0eb9..b8df88843 100644 --- a/bin/install-qa-check.d/80libraries +++ b/bin/install-qa-check.d/80libraries @@ -1,7 +1,7 @@ # Check for issues with installed libraries scanelf_lib_check() { - local f x i j + local f x i j library libraries # Check for shared libraries lacking SONAMEs local qa_var="QA_SONAME_${ARCH/-/_}" @@ -40,7 +40,16 @@ scanelf_lib_check() { # Check for shared libraries lacking NEEDED entries qa_var="QA_DT_NEEDED_${ARCH/-/_}" eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")" - f=$(scanelf -ByF '%n %p' "${ED%/}"/{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED%/}/:/:") + f= + libraries=$(scanelf -ByF '%n %p' "${ED%/}"/{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]::") + if [[ -n ${libraries} ]] ; then + while IFS= read -r library ; do + # Only shared libraries containing undefined non-weak symbols actually need NEEDED entries. + if [[ -n $(nm -D "${library}" | grep -E "^ +U ") ]] ; then + f+="/${library#${ED%/}/}"$'\n' + fi + done <<< "${libraries}" + fi if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-missing-NEEDED.log if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then -- 2.21.0