summaryrefslogtreecommitdiffstats
path: root/config-db/slxldd
diff options
context:
space:
mode:
authorOliver Tappe2007-02-03 15:16:25 +0100
committerOliver Tappe2007-02-03 15:16:25 +0100
commit172942241bc50bce7561bdb29332c0d90578c27a (patch)
treeac10134e2c4692445249dbabe31675aa8009ff74 /config-db/slxldd
parentCleanup in Gentoo configuration ... (diff)
downloadcore-172942241bc50bce7561bdb29332c0d90578c27a.tar.gz
core-172942241bc50bce7561bdb29332c0d90578c27a.tar.xz
core-172942241bc50bce7561bdb29332c0d90578c27a.zip
* added support for binaries using rpaths (explicit paths specified at link stage)
* added more output in verbose mode git-svn-id: http://svn.openslx.org/svn/openslx/trunk@670 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/slxldd')
-rwxr-xr-xconfig-db/slxldd50
1 files changed, 43 insertions, 7 deletions
diff --git a/config-db/slxldd b/config-db/slxldd
index b5bc9c9f..9117a1aa 100755
--- a/config-db/slxldd
+++ b/config-db/slxldd
@@ -132,11 +132,17 @@ sub addLib
{
my $lib = shift;
my $bitwidth = shift;
+ my $rpath = shift;
if (!exists $libInfo{$lib}) {
push @libs, $lib;
my $libPath;
- foreach my $folder (@libFolders) {
+ my @folders = @libFolders;
+ if (defined $rpath) {
+ # add rpath if given (explicit paths set during link stage)
+ push @folders, split ':', $rpath;
+ }
+ foreach my $folder (@folders) {
if (-e "$folder/$lib") {
# have library matching name, now check if the platform is ok, too:
my $libFileInfo = `file --dereference $folder/$lib 2>/dev/null`;
@@ -167,30 +173,50 @@ sub addLibsForBinary
my $binary = shift;
# first do some checks:
- my $fileInfo = `file --dereference $binary 2>/dev/null`;
+ print STDERR "analyzing '$binary'...\n" if $verbose;
+ my $fileInfo = `file --dereference --brief --mime $binary 2>/dev/null`;
+ chomp $fileInfo;
+ print STDERR "\tinfo is: '$fileInfo'...\n" if $verbose;
if ($?) {
die _tr("unable to fetch file info for $binary, giving up!\n");
}
- next if $fileInfo =~ m[shell\s+script];
- # silently ignore shell scripts
+ if ($fileInfo !~ m[^application/(x-executable|x-shared)]i) {
+ # ignore anything that's not an executable or a shared library
+ print STDERR "$binary: ignored, as it isn't an executable or a shared library\n";
+ next;
+ }
my $bitwidth = ($fileInfo =~ m[64-bit]i) ? 64 : 32;
# determine whether binary is 32- or 64-bit platform
-
+
# now find out about needed libs, we first try objdump...
+ print STDERR "\ttrying objdump...\n" if $verbose;
my $res = `objdump -p $binary 2>/dev/null`;
if (!$?) {
+ # find out if rpath is set for binary:
+ my $rpath;
+ if ($res =~ m[^\s*RPATH\s*(\S+)]im) {
+ $rpath = $1;
+ print STDERR "\trpath='$rpath'\n" if $verbose;
+ }
while($res =~ m[^\s*NEEDED\s*(.+?)\s*$]gm) {
- addLib($1, $bitwidth);
+ addLib($1, $bitwidth, $rpath);
}
} else {
# ...objdump failed, so we try readelf instead:
+ print STDERR "\ttrying readelf...\n" if $verbose;
$res = `readelf -d $binary 2>/dev/null`;
if ($?) {
die _tr("neither objdump nor readelf seems to be installed, giving up!\n");
}
+ # find out if rpath is set for binary:
+ my $rpath;
+ if ($res =~ m/Library\s*rpath:\s*\[([^\]]+)/im) {
+ $rpath = $1;
+ print STDERR "\trpath='$rpath'\n" if $verbose;
+ }
while($res =~ m{\(NEEDED\)[^\[]+\[(.+?)\]\s*$}gm) {
- addLib($1, $bitwidth);
+ addLib($1, $bitwidth, $rpath);
}
}
}
@@ -209,7 +235,9 @@ slxldd [options] file [...more files]
Options:
--help brief help message
+ --man show full documentation
--root-path=<string> path to the root folder for library search
+ --verbose show what's going on during execution
--version show version
=head1 OPTIONS
@@ -220,6 +248,10 @@ slxldd [options] file [...more files]
Prints a brief help message and exits.
+=item B<--man>
+
+Prints the manual page and exits.
+
=item B<--root-path=<string>>
Sets the root folder that is used when searching for libraries. In order to
@@ -228,6 +260,10 @@ all libraries are sought relative to this path, too (a.k.a. a virtual chroot).
Defaults to '/'.
+=item B<--verbose>
+
+Prints info about the files as they are being scanned.
+
=item B<--version>
Prints the version and exits.