Skip to content

Provide default packaging hook for compressing GNU debug symbols while packaging #230

@Ext3h

Description

@Ext3h

By default, debug builds with GNU toolchains are producing uncompressed debug symbol streams. Those make up for a vast majority of the extra file size in debug builds. (At least when unpacked to the conan cache...)

For the longest time, the GNU compiler tool chain has supported compression of the debug symbol sections via objcopy --compress-debug-sections $file. Newer GNU versions as well as LLVM even have have learned --compress-debug-sections=zstd which achieves a yet even better compression ratio, but also produces symbols that require a likewise recent version of GDB and alike to use directly.

Compressed debug symbols are universally compatible with debuginfod, SSQP and alike. They do not conflict with other strategies like extracting and linking debug symbols etc.

The compression is reversible if required for compatibility with older tools.

It's perfectly safe to just apply the debug section compression in-place to all executables produced in a build like so:

find "$local_package_folder" -type f -executable -print0 | xargs -0 -n 1 -I{} -P "$(nproc)" objcopy --compress-debug-sections {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions