Package: libdpkg-perl
Version: 1.22.11
Severity: normal
Tags: sid patch

SFrame is a stack trace format.
   https://sourceware.org/binutils/wiki/sframe

This can be generated since binutils 2.41.
There are patches against the Linux kernel to let perf use the new
format
   https://lore.kernel.org/all/cover.1726268190.git.jpoim...@kernel.org/

It would be nice if the compiled binaries could create the additional
sframe so it is there and can be used to generate backtraces. This can
coexist with the eh_frame.

Sebastian
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Tue, 26 Nov 2024 23:22:58 +0100
Subject: [PATCH] Enable SFrame generation if supported.

SFrame is a stack trace format.
   https://sourceware.org/binutils/wiki/sframe

This can be generated since binutils 2.41.
There are patches against the Linux kernel to let perf use the new
format
   https://lore.kernel.org/all/cover.1726268190.git.jpoim...@kernel.org/

It would be nice if the compiled binaries could create the additional
sframe so it is there and can be used to generate backtraces. This can
coexist with the eh_frame.

Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 scripts/Dpkg/Vendor/Debian.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index edf94bc199163..44a6fb328dd05 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -647,6 +647,18 @@ sub add_build_flags {
         }
     }
 
+    # Enable S-Frame support on supported architectures.
+    my $arch = Dpkg::Arch::get_host_arch();
+    if (any { $arch eq $_ } qw(amd64 arm64)) {
+        my $flag = '-Wa,--gsframe';
+
+        $flags->append('ASFLAGS', '--gsframe');
+        $flags->append('CFLAGS', $flag);
+        $flags->append('CXXFLAGS', $flag);
+        $flags->append('OBJCFLAGS', $flag);
+        $flags->append('OBJCXXFLAGS', $flag);
+    }
+
     # XXX: Handle *_FOR_BUILD flags here until we can properly initialize them.
     require Dpkg::Arch;
 
-- 
2.45.2

Reply via email to