diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-07-11 08:39:24 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-07-11 08:39:24 +0000 |
commit | 3edf4186c45dbf9709b41c6f82b49c0472c432b0 (patch) | |
tree | 0beeadbddcef31da83bbcab301aae3a34620f3ce | |
parent | a07cf72956376573e9caffce99da11a3c78c74c2 (diff) |
fix bug for real. Turns out some libraries (xcb...) have NEEDED that go
to standard ldconfig search dirs...
Of course, ld complains because it doesn't have them in its standard
search dir. BUT there's an option -rpath-link designed just for that
(look up needed objects during compile and trust the end result to
find them).
So use that for ldconfig directories... so that xcb can link without
needing to go have a look at the NEEDED list, but without encoding
standard rpaths in the resulting binary...
Also, put all the junk that needs -Wl together so we can add one single
-Wl,-rpath,foo,-rpath-link,foo2 thingy...
-rw-r--r-- | usr.bin/libtool/LT/Program.pm | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.bin/libtool/LT/Program.pm b/usr.bin/libtool/LT/Program.pm index 8764532e264..9d1eca14cf0 100644 --- a/usr.bin/libtool/LT/Program.pm +++ b/usr.bin/libtool/LT/Program.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Program.pm,v 1.12 2012/07/10 18:11:36 espie Exp $ +# $OpenBSD: Program.pm,v 1.13 2012/07/11 08:39:23 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org> # Copyright (c) 2012 Marc Espie <espie@openbsd.org> @@ -143,12 +143,16 @@ sub link LT::Archive->get_symbollist($symbolsfile, $gp->export_symbols_regex, $self->{objlist}); } $libdirs = reverse_zap_duplicates_ref($libdirs); + my $rpath_link = {}; # add libdirs to rpath if they are not in standard lib path for my $l (@$libdirs) { - push @$RPdirs, $l; + if (LT::OSConfig->is_search_dir($l)) { + $rpath_link->{$l} = 1; + } else { + push @$RPdirs, $l; + } } $RPdirs = reverse_zap_duplicates_ref($RPdirs); - map { $_ = "-Wl,-rpath,$_" } @$RPdirs; foreach my $k (keys %$libs) { tprint {"key = $k - "}; my $r = ref($libs->{$k}); @@ -183,14 +187,24 @@ sub link } } + my @linkeropts = (); + for my $d (@$RPdirs) { + push(@linkeropts, '-rpath', $d); + } + for my $d (keys %$rpath_link) { + push(@linkeropts, '-rpath-link', $d); + } + if ($symbolsfile) { + push(@linkeropts, '-retain-symbols-file', $symbolsfile); + } + push(@linkeropts, @$RPdirs); @cmd = @$ltprog; push @cmd, '-o', $dst; push @cmd, @$args if ($args); push @cmd, @{$self->{objlist}} if @{$self->{objlist}}; push @cmd, @$staticlibs if @$staticlibs; push @cmd, "-L$symlinkdir", @libflags if @libflags; - push @cmd, @$RPdirs if @$RPdirs; - push @cmd, "-Wl,-retain-symbols-file,$symbolsfile" if ($symbolsfile); + push @cmd, '-Wl,'. join(',', @linkeropts) if @linkeropts; LT::Exec->link(@cmd); } 1; |