Package: dpkg
Version: 1.15.6.1
Severity: minor
Tags: patch
Hi there
When cross-building, tools using Dpkg/Shlibs/Objdump.pm will call
/usr/bin/objdump instead of its $triplet-objdump counterpart from the
cross-toolchain.
It was never reported so far because it's a common issue in upstream
build systems as well, and there's an easy workaround in the form of
binutils-multiarch. dpkg-cross depends on binutils-multiarch.
However, this means that one has to rebuild binutils-multiarch to
cross-build for an architecture not supported by binutils-multiarch.
Thanks for considering the attached patch,
--
Loïc Minier
diff -Nru dpkg-1.15.6.1/debian/changelog dpkg-1.15.6.2/debian/changelog
--- dpkg-1.15.6.1/debian/changelog 2010-03-25 00:52:32.000000000 +0100
+++ dpkg-1.15.6.2/debian/changelog 2010-04-19 12:38:29.000000000 +0200
@@ -1,3 +1,9 @@
+dpkg (1.15.6.2) UNRELEASED; urgency=low
+
+ * scripts/Dpkg/Shlibs/Objdump.pm: Use triplet-objdump when cross-building.
+
+ -- Loïc Minier <[email protected]> Mon, 19 Apr 2010 12:38:01 +0200
+
dpkg (1.15.6.1) experimental; urgency=low
[ Guillem Jover ]
diff -Nru dpkg-1.15.6.1/scripts/Dpkg/Shlibs/Objdump.pm dpkg-1.15.6.2/scripts/Dpkg/Shlibs/Objdump.pm
--- dpkg-1.15.6.1/scripts/Dpkg/Shlibs/Objdump.pm 2010-03-21 09:46:34.000000000 +0100
+++ dpkg-1.15.6.2/scripts/Dpkg/Shlibs/Objdump.pm 2010-04-19 12:39:43.000000000 +0200
@@ -80,8 +80,13 @@
return $format{$file};
} else {
local $ENV{LC_ALL} = "C";
- open(P, "-|", "objdump", "-a", "--", $file)
- || syserr(_g("cannot fork for %s"), "objdump");
+ my $od = "objdump";
+ # cross-compiling?
+ if ($ENV{'DEB_BUILD_GNU_TYPE'} ne $ENV{'DEB_HOST_GNU_TYPE'}) {
+ $od = $ENV{'DEB_HOST_GNU_TYPE'} . "-objdump";
+ }
+ open(P, "-|", "$od", "-a", "--", $file)
+ || syserr(_g("cannot fork for %s"), "$od");
while (<P>) {
chomp;
if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) {
@@ -89,7 +94,7 @@
return $format{$file};
}
}
- close(P) or subprocerr(_g("objdump on \`%s'"), $file);
+ close(P) or subprocerr(_g("$od on \`%s'"), $file);
}
}
}
@@ -154,8 +159,13 @@
$self->{file} = $file;
local $ENV{LC_ALL} = 'C';
- open(my $objdump, "-|", "objdump", "-w", "-f", "-p", "-T", "-R", $file)
- || syserr(_g("cannot fork for %s"), "objdump");
+ my $od = "objdump";
+ # cross-compiling?
+ if ($ENV{'DEB_BUILD_GNU_TYPE'} ne $ENV{'DEB_HOST_GNU_TYPE'}) {
+ $od = $ENV{'DEB_HOST_GNU_TYPE'} . "-objdump";
+ }
+ open(my $objdump, "-|", "$od", "-w", "-f", "-p", "-T", "-R", $file)
+ || syserr(_g("cannot fork for %s"), "$od");
my $ret = $self->parse_objdump_output($objdump);
close($objdump);
return $ret;