summaryrefslogtreecommitdiff
path: root/usr.bin/libtool
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-07-11 13:54:49 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-07-11 13:54:49 +0000
commit5d34153e0cd1c2fcdb76768bb79fe7f3974dfe63 (patch)
tree24a64fcf657d7ae069ba6dcbf7453169a16b0f80 /usr.bin/libtool
parent6d17cf6962cf8f7c9c0d01d649a0d3a09d259fb7 (diff)
try to make code vaguely sane
Diffstat (limited to 'usr.bin/libtool')
-rw-r--r--usr.bin/libtool/LT/Mode/Link.pm12
-rw-r--r--usr.bin/libtool/LT/Parser.pm20
2 files changed, 16 insertions, 16 deletions
diff --git a/usr.bin/libtool/LT/Mode/Link.pm b/usr.bin/libtool/LT/Mode/Link.pm
index 599ae181651..c4f90c251bb 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.9 2012/07/11 08:35:47 espie Exp $
+# $OpenBSD: Link.pm,v 1.10 2012/07/11 13:54:48 espie Exp $
#
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -203,8 +203,6 @@ sub run
my $deplibs = []; # list of dependent libraries (both -L and -l flags)
my $parser = LT::Parser->new(\@ARGV);
- $parser->{result} = [];
-
if ($linkmode == PROGRAM) {
require LT::Program;
@@ -215,9 +213,7 @@ sub run
push(@{$parser->{args}}, "-Wl,-E");
}
- $parser->parse_linkargs1($deplibs, $gp,
- $dirs, $libs, $parser->{args}, 0);
- $parser->{args} = $parser->{result};
+ $parser->parse_linkargs1($deplibs, $gp, $dirs, $libs);
tsay {"end parse_linkargs1"};
tsay {"deplibs = @$deplibs"};
@@ -267,9 +263,7 @@ sub run
}
$shared = 0 if $noshared;
- $parser->parse_linkargs1($deplibs, $gp,
- $dirs, $libs, $parser->{args}, 0);
- $parser->{args} = $parser->{result};
+ $parser->parse_linkargs1($deplibs, $gp, $dirs, $libs);
tsay {"end parse_linkargs1"};
tsay {"deplibs = @$deplibs"};
diff --git a/usr.bin/libtool/LT/Parser.pm b/usr.bin/libtool/LT/Parser.pm
index 1e93392caf4..c2eaf5f7977 100644
--- a/usr.bin/libtool/LT/Parser.pm
+++ b/usr.bin/libtool/LT/Parser.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Parser.pm,v 1.6 2012/07/11 13:25:44 espie Exp $
+# $OpenBSD: Parser.pm,v 1.7 2012/07/11 13:54:48 espie Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -84,8 +84,6 @@ sub resolve_la
my $o = { result => [], deplibs => $deplibs, libdirs => $libdirs};
- $self->{result} = [];
-
$self->internal_resolve_la($o, $self->{args});
if ($o->{pthread}) {
unshift(@{$o->{result}}, '-pthread');
@@ -93,7 +91,7 @@ sub resolve_la
}
$self->{result} = $o->{result};
- return $self->{result};
+ return $o->{result};
}
# parse link flags and arguments
@@ -108,7 +106,7 @@ sub resolve_la
# -Lfoo, -lfoo, foo.a, foo.la
# recursively find .la files corresponding to -l flags; if there is no .la
# file, just inspect the library file itself for any dependencies.
-sub parse_linkargs1
+sub internal_parse_linkargs1
{
state $seen_pthread = 0;
my ($self, $deplibs, $gp, $dirs, $libs, $args, $level) = @_;
@@ -172,7 +170,7 @@ sub parse_linkargs1
push @$deplibs, $a;
push(@$result, $a);
my $dummy = []; # no need to add deplibs recursively
- $self->parse_linkargs1($dummy, $gp, $dirs, $libs,
+ $self->internal_parse_linkargs1($dummy, $gp, $dirs, $libs,
\@largs, $level+1) if @largs;
} elsif ($a =~ m/(\S+\/)*(\S+)\.a$/) {
(my $key = $2) =~ s/^lib//;
@@ -214,6 +212,14 @@ sub parse_linkargs1
}
}
+sub parse_linkargs1
+{
+ my ($self, $deplibs, $gp, $dirs, $libs, $args) = @_;
+ $self->internal_parse_linkargs1($deplibs, $gp, $dirs, $libs,
+ $self->{args}, 0);
+ $self->{args} = $self->{result};
+}
+
# pass 2
# -Lfoo, -lfoo, foo.a
# no recursion in pass 2
@@ -309,6 +315,6 @@ sub parse_linkargs2
sub new
{
my ($class, $args) = @_;
- bless { args => $args }, $class;
+ bless { args => $args, result => [] }, $class;
}
1;