Control: tags -1 + patch
Control: tags -1 - moreinfo
Please find attached a patch stripping the LTO information, together with an
option to explicitly keep it.
lintian probably only needs to warn about the sections found in static archives.
* dh_strip: Strip LTO sections unless --keep-lto is given.
diff -Nru debhelper-12.6.1/dh_strip debhelper-12.6.1+nmu1/dh_strip
--- debhelper-12.6.1/dh_strip 2019-09-08 06:34:14.000000000 +0000
+++ debhelper-12.6.1+nmu1/dh_strip 2019-09-17 08:41:18.000000000 +0000
@@ -114,6 +114,14 @@
Historical name for B<--dbgsym-migration>.
+=item B<--keep-lto>
+
+Sections containing information generated by B<-flto -ffat-lto-objects>
+are normally removed from static archives, because the streaming
+format changes even in minor GCC versions, and because cross package
+link time optimizations are normally not desired. This option allows
+to keep this information in the static libraries.
+
=back
=head1 NOTES
@@ -138,6 +146,7 @@
init(options => {
'keep-debug|keep|k' => \$dh{K_FLAG},
+ 'keep-lto' => \$dh{KEEP_LTO},
'dbgsym-migration=s' => \$dh{MIGRATE_DBGSYM},
'automatic-dbgsym!' => \$dh{ENABLE_DBGSYM},
# Deprecated variants
@@ -376,8 +385,15 @@
foreach (@static_libs) {
# NB: The short variant (-D) is broken in Jessie
# (binutils/2.25-3)
- doit($strip, '--strip-debug', '--remove-section=.comment',
- '--remove-section=.note', '--enable-deterministic-archives', $_);
+ if ($dh{KEEP_LTO}) {
+ doit($strip, '--strip-debug', '--remove-section=.comment',
+ '--remove-section=.note', '--enable-deterministic-archives', $_);
+ } else {
+ doit($strip, '--strip-debug', '--remove-section=.comment',
+ '--remove-section=.note', '--enable-deterministic-archives',
+ '-R', '.gnu.lto_*', '-R', '.gnu.debuglto_*',
+ '-N', '__gnu_lto_slim', '-N', '__gnu_lto_v1', $_);
+ }
}
if (-d "$tmp/usr/lib/debug/.dwz" and ($use_build_id > 1 or ($dh{DEBUGPACKAGE} and $dh{DEBUGPACKAGE} ne $package))) {
my @files = glob_expand(["$tmp/usr/lib/debug/.dwz"], \&glob_expand_error_handler_reject, '*');