aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-07-20 00:03:22 -0400
committerMike Frysinger <vapier@gentoo.org>2015-07-20 00:03:22 -0400
commit26ee546756ce9e1bb84951bc5cfac3cdde87a2d1 (patch)
tree32aadcd8882dd067feafe35b9ac0e570b001ab72 /lddtree.py
parentscanelf: do not warn about invalid archive entries by default (diff)
downloadpax-utils-26ee546756ce9e1bb84951bc5cfac3cdde87a2d1.tar.gz
pax-utils-26ee546756ce9e1bb84951bc5cfac3cdde87a2d1.tar.bz2
pax-utils-26ee546756ce9e1bb84951bc5cfac3cdde87a2d1.zip
lddtree: handle direct ldso linkage betterv1.0.5
If the ELF we're showing is linked directly against the ELF which is used as the ELF interp (i.e. the ldso), make sure we don't list it twice. We want to see it "twice" in the pretty form: $ ./lddtree.py /bin/bash /bin/bash (interpreter => /lib/ld-linux-armhf.so.3) <= here libreadline.so.6 => /lib/libreadline.so.6 libncurses.so.5 => /lib/libncurses.so.5 libc.so.6 => /lib/libc.so.6 ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 <= here But not in the list form (as that is used by scripts): $ ./lddtree.py -l /bin/bash /bin/bash /lib/ld-linux-armhf.so.3 <= only here /lib/libreadline.so.6 /lib/libncurses.so.5 /lib/libc.so.6 We also reconcile a few differences wrt interp display and the sh/py implementations. Reported-by: Tomasz Buchert <tomasz@debian.org>
Diffstat (limited to 'lddtree.py')
-rwxr-xr-xlddtree.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/lddtree.py b/lddtree.py
index 645cfd1..9330295 100755
--- a/lddtree.py
+++ b/lddtree.py
@@ -510,17 +510,26 @@ def _ActionShow(options, elf):
chain_libs.pop()
shown_libs = set(elf['needed'])
+ new_libs = elf['needed'][:]
chain_libs = []
interp = elf['interp']
if interp:
- shown_libs.add(os.path.basename(interp))
+ lib = os.path.basename(interp)
+ shown_libs.add(lib)
+ # If we are in non-list mode, then we want to show the "duplicate" interp
+ # lines -- first the header (interp=>xxx), and then the DT_NEEDED line to
+ # show that the ELF is directly linked against the interp.
+ # If we're in list mode though, we only want to show the interp once.
+ # Unless of course we have the --all flag active, then we show everything.
+ if not options.all and options.list and lib in new_libs:
+ new_libs.remove(lib)
if options.list:
print(elf['path'])
if not interp is None:
print(interp)
else:
print('%s (interpreter => %s)' % (elf['path'], interp))
- for lib in elf['needed']:
+ for lib in new_libs:
_show(lib, 1)