#1107313 strip from binutils 2.44.50.20250528-1 corrupts "foreign" excutable or shared library

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Roderich Schupp
Date:
2025-06-05 12:33:01 UTC
Severity:
normal
#1107313#5
Date:
2025-06-05 12:31:56 UTC
From:
To:
On a amd64 machine, running strip on a arm64 executable or shared library
corrupts the file. As an example I used the hello executable from
hello_2.10-5_arm64.deb:

$ dpkg-deb -x hello_2.10-5_arm64.deb /tmp
$ cd /tmp/usr/bin/
$ cp hello hello.bak            # back up original file
$ file hello
hello: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux-aarch64.so.1,
BuildID[sha1]=fb637bb2f93f7ec7ffef9dd41c009109fe7cfb67, for GNU/Linux 3.7.0,
stripped

with strip from binutils from 2.44-3:

$ strip --version
GNU strip (GNU Binutils for Debian) 2.44
$ strip hello
strip: Unable to recognise the format of the input file `hello'
$ cmp -l hello.bak hello        # no change, file not written to

with strip from binutils from  2.44.50.20250528-1

$ strip --version
GNU strip (GNU Binutils for Debian) 2.44.50.20250528
$ strip hello
$ cmp -l hello.bak hello
   19 267   0
67061  30  14
$ file hello
hello: ELF 64-bit LSB pie executable, no machine, version 1 (SYSV), dynamically
linked, interpreter /lib/ld-linux-aarch64.so.1,
BuildID[sha1]=fb637bb2f93f7ec7ffef9dd41c009109fe7cfb67, for GNU/Linux 3.7.0,
stripped
# note: "no machine" instead of "ARM aarch64"

This file will NOT execute on an arm64 machine, a similarily corrupted shared
library will NOT be considered by the arm64 runtime linker.