Package: dpkg-dev Version: 1.22.1 Severity: wishlist Tags: patch
Please add support to enable to build with frame-pointer turned on. The compilers in unstable default to -fomit-framepointer, this turns on -fno-omit-framepointer plus an architecture specific option.
To enable it, use DEB_BUILD_MAINT_OPTIONS="... qa=+framepointer"The chosen area might not be ideal, it could also be added to the optimize area, however it is a "negative" optimization.
Currently the default is not changed in Debian.
diff -Nru dpkg-1.22.1ubuntu3/debian/changelog dpkg-1.22.1ubuntu4/debian/changelog --- dpkg-1.22.1ubuntu3/debian/changelog 2023-11-23 10:55:44.000000000 +0100 +++ dpkg-1.22.1ubuntu4/debian/changelog 2023-12-13 09:35:27.000000000 +0100 @@ -1,3 +1,15 @@ +dpkg (1.22.1ubuntu4) UNRELEASED; urgency=medium + + * dpkg-buildflags: Add a new feature "framepointer" in the "qa" area. + * Turn on the use of frame pointers by default on 64bit architectures. + - Add -fno-omit-frame-pointer. + - On amd64 and arm64 also add -mno-omit-leaf-frame-pointer. + - On s390x, also add -mbackchain. + * To build without frame pointers, set before setting up buildflags: + DEB_BUILD_MAINT_OPTIONS="... qa=-framepointer ...". + + -- Matthias Klose <d...@ubuntu.com> Wed, 13 Dec 2023 09:35:27 +0100 + dpkg (1.22.1ubuntu3) noble; urgency=medium * Disable -fstack-clash-protection on armhf since it causes crashes diff -Nru dpkg-1.22.1ubuntu3/scripts/Dpkg/Vendor/Debian.pm dpkg-1.22.1ubuntu4/scripts/Dpkg/Vendor/Debian.pm --- dpkg-1.22.1ubuntu3/scripts/Dpkg/Vendor/Debian.pm 2023-11-23 10:55:44.000000000 +0100 +++ dpkg-1.22.1ubuntu4/scripts/Dpkg/Vendor/Debian.pm 2023-12-13 09:35:27.000000000 +0100 @@ -118,6 +118,7 @@ qa => { bug => 0, canary => 0, + framepointer => 0, }, reproducible => { timeless => 1, @@ -463,6 +464,20 @@ $flags->append('LDFLAGS', "-Wl,-z,deb-canary-${id}"); } + require Dpkg::Arch; + my $arch = Dpkg::Arch::get_host_arch(); + + if ($flags->use_feature('qa', 'framepointer')) { + $flags->append($_, '-fno-omit-frame-pointer') foreach @compile_flags; + if (Dpkg::Arch::debarch_eq($arch, 'amd64')) { + $flags->append($_, '-mno-omit-leaf-frame-pointer') foreach @compile_flags; + } elsif (Dpkg::Arch::debarch_eq($arch, 'arm64')) { + $flags->append($_, '-mno-omit-leaf-frame-pointer') foreach @compile_flags; + } elsif (Dpkg::Arch::debarch_eq($arch, 's390x')) { + $flags->append($_, '-mbackchain') foreach @compile_flags; + } + } + ## Area: reproducible # Warn when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used. diff -Nru dpkg-1.22.1ubuntu3/scripts/Dpkg/Vendor/Ubuntu.pm dpkg-1.22.1ubuntu4/scripts/Dpkg/Vendor/Ubuntu.pm --- dpkg-1.22.1ubuntu3/scripts/Dpkg/Vendor/Ubuntu.pm 2023-11-23 10:55:44.000000000 +0100 +++ dpkg-1.22.1ubuntu4/scripts/Dpkg/Vendor/Ubuntu.pm 2023-12-13 09:35:27.000000000 +0100 @@ -177,6 +177,10 @@ $use_feature->{optimize}{lto} = 0; } } + + if (any { $_ eq $arch } qw(amd64 arm64 ppc64el riscv64 s390x)) { + $use_feature->{qa}{framepointer} = 1; + } } sub set_build_features {