From 1c2c6ce514c967348ebae88e5afc5ed3ff9da183 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Tue, 14 Aug 2007 15:09:58 +0200 Subject: [PATCH] Don't consider local symbols when merging symbols in SymbolFile Local symbols can only be used by the object defining them so they can't be used by applications linked against the library. Hence they are not needed in the "symbols" files that we used to track dependencies on shared libraries. Use the get_exported_dynamic_symbols function to ensure that we use the right set of symbols. --- scripts/Dpkg/Shlibs/Objdump.pm | 2 +- scripts/Dpkg/Shlibs/SymbolFile.pm | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index 19a38f47..307e63b5 100644 --- a/scripts/Dpkg/Shlibs/Objdump.pm +++ b/scripts/Dpkg/Shlibs/Objdump.pm @@ -296,7 +296,7 @@ sub get_symbol { sub get_exported_dynamic_symbols { my ($self) = @_; - return grep { $_->{defined} && $_->{dynamic} } + return grep { $_->{defined} && $_->{dynamic} && !$_->{local} } values %{$self->{dynsyms}}; } diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 329f763a..f1d0bede 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -182,12 +182,15 @@ sub dump { sub merge_symbols { my ($self, $object, $minver) = @_; my $soname = $object->{SONAME} || error(_g("Can't merge symbols from objects without SONAME.")); - my %dynsyms = map { $_ => $object->{dynsyms}{$_} } - grep { - local $a = $object->{dynsyms}{$_}; - $a->{dynamic} && $a->{defined} && not exists $blacklist{$a->{name}} + my %dynsyms; + foreach my $sym ($object->get_exported_dynamic_symbols()) { + next if exists $blacklist{$sym->{name}}; + if ($sym->{version}) { + $dynsyms{$sym->{name} . '@' . $sym->{version}} = $sym; + } else { + $dynsyms{$sym->{name}} = $sym; } - keys %{$object->{dynsyms}}; + } unless ($self->{objects}{$soname}) { $self->create_object($soname, ''); -- 2.39.5