summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-09-21 08:49:07 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-09-21 08:49:07 +0000
commitb92a9edce473bceeb6e739b4aa7a76d6c6935c7f (patch)
tree186b9c28936a4421057db30c92f37e93f06f412d /usr.bin
parent274856bf8f00a3665c48d9a3a8a51e3bc40479cf (diff)
Fix a couple of libtool issues:
* when looking for a library, also look for an unversioned solib before falling back to using the static one (which may not even exist) * when a library has no libtool file (.la) with a proper dependency_libs entry, libtool(1) falls back to using objdump to determine the depencencies; however this works only if dependencies are in standard search paths; fix it by looking at the RPATH entry in objdump then add non standard dirs to search_dirs and -rpath inputs from and ok espie@, ok jasper@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/libtool/LT/Library.pm33
-rw-r--r--usr.bin/libtool/LT/Mode/Link.pm11
2 files changed, 42 insertions, 2 deletions
diff --git a/usr.bin/libtool/LT/Library.pm b/usr.bin/libtool/LT/Library.pm
index 69c152bf5d5..ae81645c101 100644
--- a/usr.bin/libtool/LT/Library.pm
+++ b/usr.bin/libtool/LT/Library.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Library.pm,v 1.11 2014/04/16 14:39:05 zhuk Exp $
+# $OpenBSD: Library.pm,v 1.12 2015/09/21 08:49:06 ajacoutot Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -158,6 +158,12 @@ sub findbest
}
closedir($dir);
}
+ if (!defined $best) {
+ my $cand = "$sd/lib$name.so";
+ if (-e $cand) {
+ $best = $cand;
+ }
+ }
return $best;
}
@@ -185,6 +191,31 @@ sub inspect
return @deps;
}
+# give the list of RPATH directories
+sub findrpaths
+{
+ my $self = shift;
+
+ my $filename = $self->{fullpath};
+ my @dirs;
+
+ if (!defined($filename)){
+ say "warning: library was specified that could not be found: $self->{key}";
+ return;
+ }
+ tsay {"inspecting $filename for non standard RPATH..."};
+ open(my $fh, '-|', "objdump", "-p", "--", $filename);
+ while (<$fh>) {
+ if (m/RPATH\s+(.*)$/) {
+ @dirs = split(":", $1);
+ last;
+ }
+ }
+ tsay {"found ", (@dirs == 0) ? 'none ' : '',
+ "RPATH for $filename\n@dirs"};
+ return @dirs;
+}
+
sub new
{
my ($class, $key) = @_;
diff --git a/usr.bin/libtool/LT/Mode/Link.pm b/usr.bin/libtool/LT/Mode/Link.pm
index bb7c13b0348..adad4773afe 100644
--- a/usr.bin/libtool/LT/Mode/Link.pm
+++ b/usr.bin/libtool/LT/Mode/Link.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Link.pm,v 1.29 2014/04/27 18:08:35 zhuk Exp $
+# $OpenBSD: Link.pm,v 1.30 2015/09/21 08:49:06 ajacoutot Exp $
#
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -608,6 +608,15 @@ sub internal_parse_linkargs1
} elsif ($type eq 'LT::Library') {
$libs->{$key}->{fullpath} = $file;
my @deps = $libs->{$key}->inspect;
+ # add RPATH dirs to our search_dirs in case the dependent
+ # library is installed under a non-standard path
+ my @rpdirs = $libs->{$key}->findrpaths;
+ foreach my $r (@rpdirs) {
+ if (!LT::OSConfig->is_search_dir($r)) {
+ push @$dirs, $r;
+ $gp->add_R($r);
+ }
+ }
foreach my $d (@deps) {
my $k = basename($d);
# XXX will fail for (_pic)?\.a$