sub parse {
my ($self, $file) = @_;
local $ENV{LC_ALL} = 'C';
- open(OBJDUMP, "-|", "objdump", "-w", "-p", "-T", $file) ||
+ open(OBJDUMP, "-|", "objdump", "-w", "-p", "-T", $file) ||
syserr(sprintf(_g("Can't execute objdump: %s"), $!));
my $obj = Dpkg::Shlibs::Objdump::Object->new($file);
my $section = "none";
while (defined($_ = <OBJDUMP>)) {
chomp($_);
next if (/^\s*$/);
-
+
if ($_ =~ /^DYNAMIC SYMBOL TABLE:/) {
$section = "dynsym";
next;
# Output format of objdump -w -T
#
# /lib/libc.so.6: file format elf32-i386
-#
+#
# DYNAMIC SYMBOL TABLE:
# 00056ef0 g DF .text 000000db GLIBC_2.2 getwchar
# 00000000 g DO *ABS* 00000000 GCC_3.0 GCC_3.0
# 0000b788 g DF .text 0000008e Base .protected xine_close
# | ||||||| | | | |
# | ||||||| | | Version str (.visibility) + Symbol name
-# | ||||||| | Alignment
+# | ||||||| | Alignment
# | ||||||| Section name (or *UND* for an undefined symbol)
# | ||||||F=Function,f=file,O=object
# | |||||d=debugging,D=dynamic
# | |||W=warning
# | ||C=constructor
# | |w=weak
-# | g=global,l=local,!=both global/local
+# | g=global,l=local,!=both global/local
# Size of the symbol
#
# GLIBC_2.2 is the version string associated to the symbol
'hidden' => 0,
'defined' => $sect ne '*UND*'
};
-
+
# Handle hidden symbols
if (defined($ver) and $ver =~ /^\((.*)\)$/) {
$ver = $1;
{
my %format; # Cache of result
sub get_format {
- my ($file) = @_;
-
- if (exists $format{$file}) {
- return $format{$file};
- } else {
- local $ENV{LC_ALL} = "C";
- open(P, "objdump -a -- $file |") || syserr(_g("cannot fork for objdump"));
- while (<P>) {
- chomp;
- if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) {
- $format{$file} = $1;
- return $format{$file};
- }
- }
- close(P) or main::subprocerr(sprintf(_g("objdump on \`%s'"), $file));
- }
+ my ($file) = @_;
+
+ if (exists $format{$file}) {
+ return $format{$file};
+ } else {
+ local $ENV{LC_ALL} = "C";
+ open(P, "objdump -a -- $file |") || syserr(_g("cannot fork for objdump"));
+ while (<P>) {
+ chomp;
+ if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) {
+ $format{$file} = $1;
+ return $format{$file};
+ }
+ }
+ close(P) or main::subprocerr(sprintf(_g("objdump on \`%s'"), $file));
+ }
}
}
sub get_exported_dynamic_symbols {
my ($self) = @_;
- return grep { $_->{defined} && $_->{dynamic} }
+ return grep { $_->{defined} && $_->{dynamic} }
values %{$self->{dynsyms}};
}
sub get_undefined_dynamic_symbols {
my ($self) = @_;
- return grep { (!$_->{defined}) && $_->{dynamic} }
+ return grep { (!$_->{defined}) && $_->{dynamic} }
values %{$self->{dynsyms}};
}
# Update library paths with LD_LIBRARY_PATH
if ($ENV{LD_LIBRARY_PATH}) {
foreach my $path (reverse split( /:/, $ENV{LD_LIBRARY_PATH} )) {
- $path =~ s{/+$}{};
- unless (scalar grep { $_ eq $path } @librarypaths) {
- unshift @librarypaths, $path;
- }
+ $path =~ s{/+$}{};
+ unless (scalar grep { $_ eq $path } @librarypaths) {
+ unshift @librarypaths, $path;
+ }
}
}
or main::syserr(sprintf(_g("couldn't open %s: %s"), $file, $!));
while (<$fh>) {
next if /^\s*$/;
- chomp;
+ chomp;
s{/+$}{};
if (/^include\s+(\S.*\S)\s*$/) {
foreach my $include (glob($1)) {
sub merge_symbols {
my ($self, $object, $minver) = @_;
my $soname = $object->{SONAME} || main::error(_g("Can't merge symbols from objects without SONAME."));
- my %dynsyms = map { $_ => $object->{dynsyms}{$_} }
- grep { local $a = $object->{dynsyms}{$_}; $a->{dynamic} && $a->{defined} }
+ my %dynsyms = map { $_ => $object->{dynsyms}{$_} }
+ grep { local $a = $object->{dynsyms}{$_}; $a->{dynamic} && $a->{defined} }
keys %{$object->{dynsyms}};
# Scan all symbols provided by the objects
foreach my $sym (keys %dynsyms) {
foreach my $so (@{$sonames}) {
next if (! exists $self->{objects}{$so});
if (exists $self->{objects}{$so}{syms}{$name} and
- not $self->{objects}{$so}{syms}{$name}{deprecated})
+ not $self->{objects}{$so}{syms}{$name}{deprecated})
{
my $dep_id = $self->{objects}{$so}{syms}{$name}{dep_id};
return {
my $mysyms = $self->{objects}{$soname}{syms};
next if not exists $ref->{objects}{$soname};
my $refsyms = $ref->{objects}{$soname}{syms};
- foreach my $sym (grep { not $refsyms->{$_}{deprecated} }
- keys %{$refsyms})
+ foreach my $sym (grep { not $refsyms->{$_}{deprecated} }
+ keys %{$refsyms})
{
- if ((not exists $mysyms->{$sym}) or
- $mysyms->{$sym}{deprecated})
+ if ((not exists $mysyms->{$sym}) or
+ $mysyms->{$sym}{deprecated})
{
return 1;
}
my $mysyms = $self->{objects}{$soname}{syms};
next if not exists $ref->{objects}{$soname};
my $refsyms = $ref->{objects}{$soname}{syms};
- foreach my $sym (grep { not $mysyms->{$_}{deprecated} }
- keys %{$mysyms})
+ foreach my $sym (grep { not $mysyms->{$_}{deprecated} }
+ keys %{$mysyms})
{
- if ((not exists $refsyms->{$sym}) or
- $refsyms->{$sym}{deprecated})
+ if ((not exists $refsyms->{$sym}) or
+ $refsyms->{$sym}{deprecated})
{
return 1;
}