summaryrefslogtreecommitdiff
path: root/dh_dwz
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-11-16 19:39:49 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-11-16 19:40:38 +0300
commit1db0a96eb28faade39d4cef422e32f794291944e (patch)
tree38dc153d770b6803d45a9894ceca890ad528114a /dh_dwz
parent04978ba1e0d855d6161da70e22320bf84d47ff16 (diff)
parentb1a9d1a622291373b7abc4eff2a6b2b2fef62083 (diff)
downloaddebhelper-1db0a96eb28faade39d4cef422e32f794291944e.tar.gz
Merge https://salsa.debian.org/debian/debhelper
Diffstat (limited to 'dh_dwz')
-rwxr-xr-xdh_dwz38
1 files changed, 29 insertions, 9 deletions
diff --git a/dh_dwz b/dh_dwz
index a714c766..471930b9 100755
--- a/dh_dwz
+++ b/dh_dwz
@@ -30,9 +30,17 @@ running L<dwz(1)> on all the ELF binaries in the package.
=item B<--dwz-multifile>, B<--no-dwz-multifile>
Whether L<dwz(1)> should generate a I<multifile> from the ELF binaries
-in the same package (it does by default). When enabled, if a package
-ships at least 2 ELF binaries, B<dh_dwz> will instruct L<dwz(1)> to
-generate a multifile for the package.
+in the same package. When enabled, if a package ships at least 2 ELF
+binaries, B<dh_dwz> will instruct L<dwz(1)> to generate a multifile
+for the package.
+
+By default, B<dh_dwz> will attempt to create a multifile but will
+continue without if L<dwz(1)> does create one (but succeeds anyway).
+This commonly happens when the debug files do not contain debug
+symbols (e.g. a missing -g to the compiler) or when the debug
+symbols are compressed (see Debian bug #931891). If B<--dwz-multifile>
+is passed, then B<dh_dwz> will abort with an error if L<dwz(1)> does
+not create a multifile.
Note this options may not work if a package contains more ELF binaries
than can fit on a single command line. If this becomes a problem,
@@ -41,6 +49,10 @@ please pass B<--no-dwz-multifile> to work around the issue.
The generated multifile will be compressed with B<objcopy
--compress-debug-sections>.
+Note for B<udeb> packages: B<dh_dwz> will never generate multifiles
+for B<udeb> packages. It will still use B<dwz> to reduce the
+file size of debug files if it finds any.
+
=item B<-X>I<item>, B<--exclude=>I<item>
Exclude files that contain I<item> anywhere in their filename from being
@@ -68,7 +80,7 @@ test"-cycles) rather than optimizing for size.
=cut
-my $create_multifile = 1;
+my $create_multifile = 'auto';
init(options => {
'dwz-multifile!' => \$create_multifile,
@@ -112,18 +124,26 @@ for my $package (@{$dh{DOPACKAGES}}) {
# Consistent order;
@elf_files = sort(@elf_files);
my ($unique_files, $hardlinks) = find_hardlinks(@elf_files);
- my @dwz_options;
- if ($create_multifile and @{$unique_files} > 1) {
+ if ($create_multifile and @{$unique_files} > 1 and not is_udeb($package)) {
my $objcopy = cross_command($package, 'objcopy');
my $ma_dir = dpkg_architecture_value('DEB_HOST_MULTIARCH');
my $dwz_dir = "usr/lib/debug/.dwz/${ma_dir}";
my $m = "${dwz_dir}/${package}.debug";
my @dwz_options = ("-m${tmp}/${m}", "-M/${m}");
install_dir("${tmp}/${dwz_dir}");
- doit('dwz', '-q', @dwz_options, @{$dh{U_PARAMS}}, '--', @{$unique_files});
- doit($objcopy, '--compress-debug-sections', "${tmp}/${m}");
+ doit('dwz', @dwz_options, @{$dh{U_PARAMS}}, '--', @{$unique_files});
+ if ( -f "${tmp}/${m}") {
+ doit($objcopy, '--compress-debug-sections', "${tmp}/${m}");
+ } else {
+ error("dwz failed to create a multifile as requested") if $create_multifile ne 'auto';
+ warning("No dwz multifile created, but not explicitly requested either so ignoring it.");
+ warning("Common issues include no debug information at all (missing -g) and");
+ warning("compressed debug information (#931891).");
+ # Clean up after ourselves to avoid leaving empty directories in packages
+ doit('rmdir', '-p', '--ignore-fail-on-non-empty', "${tmp}/usr/lib/debug/.dwz/${ma_dir}");
+ }
} else {
- xargs($unique_files, 'dwz', '-q', @{$dh{U_PARAMS}}, '--');
+ xargs($unique_files, 'dwz', @{$dh{U_PARAMS}}, '--');
}