From b928b4356158a30f375991f74fcdc41a1dd33f0c 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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/install-qa-check.d/80libraries b/bin/install-qa-check.d/80libraries index bbabc0eb9..1249c1e3b 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,14 @@ 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%/}/:/:") + libraries=$(scanelf -ByF '%n %p' "${ED%/}"/{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]::") + f= + 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}" if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-missing-NEEDED.log if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then -- 2.21.0