Frank Lichtenheld лет назад: 19
Родитель
Сommit
7ee696f92c
3 измененных файлов с 40 добавлено и 40 удалено
  1. 24 24
      scripts/modules/Objdump.pm
  2. 5 5
      scripts/modules/Shlibs.pm
  3. 11 11
      scripts/modules/SymbolFile.pm

+ 24 - 24
scripts/modules/Objdump.pm

@@ -29,14 +29,14 @@ sub new {
 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;
@@ -87,7 +87,7 @@ sub parse {
 # 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
@@ -96,7 +96,7 @@ sub parse {
 # 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
@@ -104,7 +104,7 @@ sub parse {
 # |        |||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
@@ -128,7 +128,7 @@ sub parse_dynamic_symbol {
 		'hidden' => 0,
 		'defined' => $sect ne '*UND*'
 	    };
-	
+
 	# Handle hidden symbols
 	if (defined($ver) and $ver =~ /^\((.*)\)$/) {
 	    $ver = $1;
@@ -167,22 +167,22 @@ sub get_object {
 {
     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));
+	}
     }
 }
 
@@ -234,13 +234,13 @@ sub get_symbol {
 
 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}};
 }
 

+ 5 - 5
scripts/modules/Shlibs.pm

@@ -30,10 +30,10 @@ our @librarypaths = qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
 # 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;
+	}
     }
 }
 
@@ -47,7 +47,7 @@ sub parse_ldso_conf {
 	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)) {

+ 11 - 11
scripts/modules/SymbolFile.pm

@@ -120,8 +120,8 @@ sub dump {
 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) {
@@ -183,7 +183,7 @@ sub lookup_symbol {
     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 {
@@ -202,11 +202,11 @@ sub has_lost_symbols {
 	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;
 	    }
@@ -221,11 +221,11 @@ sub has_new_symbols {
 	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;
 	    }