summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Shlibs/Objdump.pm
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:00:30 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:00:30 +0300
commit414ea1706306e061fc44a8b5ce3042d4f0728489 (patch)
treeef0b2c4eac79e479ed686a5d88d7b3b954717824 /scripts/Dpkg/Shlibs/Objdump.pm
parented2b463626bd721942143baa6207f2ccac67a616 (diff)
parent89afa9af7cd589eb8384ed96b6d86dd59d56bdf5 (diff)
downloaddpkg-414ea1706306e061fc44a8b5ce3042d4f0728489.tar.gz
Merge https://salsa.debian.org/dpkg-team/dpkg
Diffstat (limited to 'scripts/Dpkg/Shlibs/Objdump.pm')
-rw-r--r--scripts/Dpkg/Shlibs/Objdump.pm35
1 files changed, 21 insertions, 14 deletions
diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index 91cc06488..4cee866e7 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -1,4 +1,5 @@
# Copyright © 2007-2010 Raphaël Hertzog <hertzog@debian.org>
+# Copyright © 2007-2009,2012-2015,2017-2018 Guillem Jover <guillem@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,17 +24,6 @@ our $VERSION = '0.01';
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Path qw(find_command);
-use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch);
-use Dpkg::IPC;
-
-# Decide which objdump to call
-our $OBJDUMP = 'objdump';
-if (get_build_arch() ne get_host_arch()) {
- my $od = debarch_to_gnutriplet(get_host_arch()) . '-objdump';
- $OBJDUMP = $od if find_command($od);
-}
-
sub new {
my $this = shift;
@@ -244,9 +234,12 @@ package Dpkg::Shlibs::Objdump::Object;
use strict;
use warnings;
+use feature qw(state);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
+use Dpkg::Path qw(find_command);
+use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch);
sub new {
my $this = shift;
@@ -268,9 +261,9 @@ sub reset {
$self->{file} = '';
$self->{id} = '';
- $self->{SONAME} = '';
$self->{HASH} = '';
$self->{GNU_HASH} = '';
+ $self->{INTERP} = 0;
$self->{SONAME} = '';
$self->{NEEDED} = [];
$self->{RPATH} = [];
@@ -281,6 +274,14 @@ sub reset {
return $self;
}
+sub _select_objdump {
+ # Decide which objdump to call
+ if (get_build_arch() ne get_host_arch()) {
+ my $od = debarch_to_gnutriplet(get_host_arch()) . '-objdump';
+ return $od if find_command($od);
+ }
+ return 'objdump';
+}
sub analyze {
my ($self, $file) = @_;
@@ -298,6 +299,7 @@ sub analyze {
return;
}
+ state $OBJDUMP = _select_objdump();
local $ENV{LC_ALL} = 'C';
open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
or syserr(g_('cannot fork for %s'), $OBJDUMP);
@@ -325,7 +327,7 @@ sub parse_objdump_output {
$section = 'dyninfo';
next;
} elsif (/^Program Header:/) {
- $section = 'header';
+ $section = 'program';
next;
} elsif (/^Version definitions:/) {
$section = 'verdef';
@@ -364,6 +366,10 @@ sub parse_objdump_output {
$self->{RPATH} = [ split /:/, $rpath ];
}
}
+ } elsif ($section eq 'program') {
+ if (/^\s*INTERP\s+/) {
+ $self->{INTERP} = 1;
+ }
} elsif ($section eq 'none') {
if (/^\s*.+:\s*file\s+format\s+(\S+)$/) {
$self->{format} = $1;
@@ -536,7 +542,8 @@ sub get_needed_libraries {
sub is_executable {
my $self = shift;
- return exists $self->{flags}{EXEC_P} && $self->{flags}{EXEC_P};
+ return (exists $self->{flags}{EXEC_P} && $self->{flags}{EXEC_P}) ||
+ (exists $self->{INTERP} && $self->{INTERP});
}
sub is_public_library {