2 eval "exec /usr/bin/env perl -w -S $0 $@"
4 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
5 # Written by Ulrich Drepper <drepper@redhat.com>, 2000.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <http://www.gnu.org/licenses/>.
19 for ($cnt = 0; $cnt <= $#ARGV; ++$cnt) {
27 open (READLINK
, "readlink -f $ARGV[$cnt] |") || die "cannot open readlink";
34 open (READELF
, "eu-readelf -d $ARGV[$cnt] |") || die "cannot open $ARGV[$cnt]";
37 if (/.* RELA?ENT *([0-9]*).*/) {
39 } elsif (/.* RELA?SZ *([0-9]*).*/) {
41 } elsif (/.* RELA?COUNT *([0-9]*).*/) {
43 } elsif (/.* PLTRELSZ *([0-9]*).*/) {
49 open (READELF
, "eu-readelf -r $ARGV[$cnt] | sed '/'.gnu.conflict'/,/^\$/d' |") || die "cannot open $ARGV[$cnt]";
52 if (/.*JU?MP_SLOT *0+ .*/) {
58 if (open (PRELINK
, "/usr/sbin/prelink -p 2>/dev/null | fgrep \"$fullpath\" |")) {
67 printf ("%s: %d relocations, %d relative (%d%%), %d PLT entries, %d for local syms (%d%%)",
68 $ARGV[$cnt], $relent == 0 ?
0 : $relsz / $relent, $relcount,
69 $relent == 0 ?
0 : ($relcount * 100) / ($relsz / $relent),
70 $relent == 0 ?
0 : $pltrelsz / $relent,
71 $relent == 0 ?
0 : $pltrelsz / $relent - $extplt,
72 $relent == 0 ?
0 : (($pltrelsz / $relent - $extplt) * 100) / ($pltrelsz / $relent));
74 printf(", %d users", $users);