summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-11-24 20:01:46 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-11-24 20:01:46 (GMT)
commit7d296c4f68c56edf59765f2c98c33e73df186e47 (patch)
tree7845577aa25e0a15fd5c8b6c06eec088b3001599
parentcd9a56ff5054319c77e912e64020bab08ac82490 (diff)
scripts/xldd: avoid reporting duplicates
Once a NEEDED dependency has been solved, do not report it if other dependencies depend on it. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
-rwxr-xr-xscripts/xldd.in23
1 files changed, 18 insertions, 5 deletions
diff --git a/scripts/xldd.in b/scripts/xldd.in
index 7e8beaa..8d4ffc9 100755
--- a/scripts/xldd.in
+++ b/scripts/xldd.in
@@ -224,14 +224,26 @@ do_find_needed() {
# Scan a file for all NEEDED tags
do_process_file() {
local file="${1}"
+ local n m
+ local found
do_trace "Parsing file '${file}'\n"
- "${readelf}" -d "${file}" \
- |"${grep}" -E '\(NEEDED\)' \
- |"${sed}" -r -e 's/^.*Shared library:[[:space:]]+\[(.*)\]$/\1/;' \
- |while read needed; do
- do_find_needed "${needed}"
+ for n in $( "${readelf}" -d "${file}" \
+ |"${grep}" -E '\(NEEDED\)' \
+ |"${sed}" -r -e 's/^.*Shared library:[[:space:]]+\[(.*)\]$/\1/;' \
+ ); do
+ found=0
+ for m in "${needed_list[@]}"; do
+ [ "${n}" = "${m}" ] && found=1 && break
+ done
+ if [ ${found} -ne 0 ]; then
+ do_trace "-> skipping already known dependency '${n}'\n"
+ continue
+ fi
+ do_trace "-> handling new dependency '${n}'\n"
+ needed_list+=( "${n}" )
+ do_find_needed "${n}"
done
}
@@ -283,4 +295,5 @@ for p in "${needed_search_path[@]}"; do
done
do_trace "Scanning file '${1}'\n"
+declare -a needed_list
do_process_file "${1}"