Source: binutils Version: 2.46-1 User: [email protected] Usertags: pac-bti, gcs
Hi Matthias, please consider the attached patch to build binutils with PAC/BTI/GCS support. I have explicitly distinguished between CFLAGS and CXXFLAGS because a user could choose to override them individually, for whatever reasons. After building the package with the patch, all ELF files get the features enabled, see: https://people.debian.org/~ema/binutils-gcs.txt Building with DEB_BUILD_MAINT_OPTIONS=hardening=-branch, the flags are not set as expected. Other than a native build, I have also tested cross-building binutils on a x86 system with `sbuild --host arm64` and that works fine too. Thanks, ema
>From c7efba8b4520196c0f2a26d4fd7ca13f071b3d20 Mon Sep 17 00:00:00 2001 From: Emanuele Rocca <[email protected]> Date: Thu, 12 Feb 2026 10:55:46 +0100 Subject: [PATCH] Enable PAC/BTI/GCS on arm64 --- debian/changelog | 6 ++++++ debian/rules | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/debian/changelog b/debian/changelog index f8ca1487..6e94fe51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +binutils (2.46-2) UNRELEASED; urgency=medium + + * Enable PAC/BTI/GCS on arm64. + + -- Emanuele Rocca <[email protected]> Thu, 12 Feb 2026 10:55:09 +0100 + binutils (2.46-1) unstable; urgency=medium * binutils 2.46 release. diff --git a/debian/rules b/debian/rules index 47569018..909619a5 100755 --- a/debian/rules +++ b/debian/rules @@ -272,6 +272,14 @@ ifneq (,$(shell dpkg-buildflags | grep '^CFLAGS=.*-mbackchain')) CFLAGS += -mbackchain CXXFLAGS += -mbackchain endif +ifeq ($(DEB_HOST_ARCH),arm64) + ifneq (,$(findstring -mbranch-protection=standard,$(shell dpkg-buildflags --get CFLAGS))) + CFLAGS += -mbranch-protection=standard + endif + ifneq (,$(findstring -mbranch-protection=standard,$(shell dpkg-buildflags --get CXXFLAGS))) + CXXFLAGS += -mbranch-protection=standard + endif +endif STRIP = $(CROSS)strip -R .comment -R .note STRIP_LTO = $(CROSS)strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_slim -N __gnu_lto_v1 -- 2.43.0

