Hi Qt

I recently discovered there is a binutils tools for size optimizing dwarf 
debug symbols, and it really works. When applied to Qt debug symbol binaries 
it makes them about 25% smaller on average (some up to 40% smaller). And that 
is just the simple optimization. We can save more by combining duplicates from 
multiple debug symbol binaries into one shared one, but that would change the 
files we ship.

In any case. While too late for 5.15 and written for qmake so not suitable for 
qt6, I would like to share my minimal change with you here, in case anybody 
would like to ship smaller debug binaries.

Is there an existing cmake way to trigger the same? Though we might also want 
to consider triggering compressed dwarf symbols at the same time, as that is 
another great reduction, but ups the minimum tool versions required.

Best regards
'Allan
diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf
index 9070cf33f0..7b7106bb80 100644
--- a/mkspecs/features/unix/separate_debug_info.prf
+++ b/mkspecs/features/unix/separate_debug_info.prf
@@ -100,10 +100,11 @@ have_target:!static:if(darwin|!isEmpty(QMAKE_OBJCOPY)) {
         mkdir_debug_info = $$QMAKE_MKDIR $$shell_quote($$debug_info_target_dir)
         QMAKE_POST_LINK = $$mkdir_debug_info && $$copy_debug_info && $$strip_debug_info $$QMAKE_POST_LINK
     } else {
+        opt_debug_info = dwz $$shell_target
         link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
         !contains(QMAKE_HOST.os, Windows): \
             QMAKE_POST_LINK = && chmod -x $$shell_target_debug_info $$QMAKE_POST_LINK
-        QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info $$QMAKE_POST_LINK
+        QMAKE_POST_LINK = $$opt_debug_info && $$copy_debug_info && $$strip_debug_info && $$link_debug_info $$QMAKE_POST_LINK
     }
     silent:QMAKE_POST_LINK = @echo creating $@.$$debug_info_suffix && $$QMAKE_POST_LINK
 
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to