Can't strip more than 256 symbols

I’m using this SFDK version 3.9.6 (Stable).

I’m compiling Whisperfish locally using this command (at the time of writing, please pull this commit instead of master):

sfdk -c target=SailfishOS-4.4.0.58-aarch64 build -- --with shareplugin_v2 --with lto

For convenience, I removed the path prefix /home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default from all outputs below.

I then see the following output:

/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: '/home/deploy/installroot/usr/bin/harbour-whisperfish,': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'too': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'many': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'notes': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: '(256)': No such file

After some searching, I found this bug report: find-debuginfo.sh fails on ELF with more than 256 notes. It has a link to a commit that fixes that: Fix stripping of binaries for changed file output. After installing vim and editing these three files to contain the changes in the commit, I now get these lines instead:

+ /[...]/usr/lib/rpm/meego/brp-strip /usr/bin/strip
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: warning: /home/deploy/installroot/usr/bin/harbour-whisperfish: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
(repeat the line above for hundreds of times)
+ /[...]/usr/lib/rpm/meego/brp-strip-static-archive /usr/bin/strip

As far as I know, the warning message is benign, and can be ignored here. Now the resulting binary is 5.1MB instead of 25MB, so the stripping process works.

For completeness; I edited these three files inside build-shell

/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip
/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip-comment-note
/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip-shared

making this change

-	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
+	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p'`; do

which fixed the issue. Athough this was triggered by a Rust application, it can happen to C/C++ applications, too.

Please include the commit or update rpm to newer version.

Thanks!

3 Likes