Package: src:binutils

The upstream binutils commit below reduced the section alignment of
armhf executables (including shared libraries) from 64k to 4k, on the
basis that the additional bloat is not justified, given that arm64 hosts
running 64k pagesize kernels with armhf user space are not used in
practice.

However, the situation is slightly different today on Debian, where a
16k pagesize kernel is provided that enables compat support, and is
therefore able to execute armhf user space. The only impediment is the
fact that armhf binaries are no longer compatible with this, due to the
change below.

To accommodate this use case, revert the patch. This makes the generated
executables compatible with compat mode on arm64 systems running 16k
kernels.

  | commit 1a26a53a0dee39106ba58fcb15496c5f13074652
  | Author: Hans-Peter Nilsson <h...@axis.com>
  | Date:   Tue Jan 3 03:19:54 2023 +0100
  |
  |     ARM: Fix ld bloat introduced between binutils-2.38 and 2.39

More info at https://sourceware.org/bugzilla/show_bug.cgi?id=30033
---
 debian/patches/armhf-64k-alignment.diff | 15 +++++++++++++++
 debian/patches/series                   |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/debian/patches/armhf-64k-alignment.diff 
b/debian/patches/armhf-64k-alignment.diff
new file mode 100644
index 0000000..7138330
--- /dev/null
+++ b/debian/patches/armhf-64k-alignment.diff
@@ -0,0 +1,15 @@
+--- a/bfd/elf32-arm.c
++++ b/bfd/elf32-arm.c
+@@ -20355,7 +20355,11 @@ elf32_arm_backend_symbol_processing (bfd *abfd, 
asymbol *sym)
+ #define ELF_ARCH                      bfd_arch_arm
+ #define ELF_TARGET_ID                 ARM_ELF_DATA
+ #define ELF_MACHINE_CODE              EM_ARM
++#ifdef __QNXTARGET__
+ #define ELF_MAXPAGESIZE                       0x1000
++#else
++#define ELF_MAXPAGESIZE                       0x10000
++#endif
+ #define ELF_COMMONPAGESIZE            0x1000
+ 
+ #define bfd_elf32_mkobject                    elf32_arm_mkobject
+
diff --git a/debian/patches/series b/debian/patches/series
index cf4b64e..7a68bd4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -34,3 +34,6 @@ mips-hack.diff
 perl-shebang.diff
 env-package-metadata.diff
 pr32392-workaround.diff
+
+# https://sourceware.org/bugzilla/show_bug.cgi?id=30033
+armhf-64k-alignment.diff

Reply via email to