[llvm-dev] llvm-strip creates unloadable shared objects on linux-armv7hf

Tobias Hieta via llvm-dev
Thu, 17 Oct 2019 08:36:26 -0000

Hello,

Recently we tried to streamline our toolchain by removing some GNU
tools with LLVM tools to avoid having multiple copies of strip, nm, ar
and similar tools. Today we ran into a really strange issue where
shared objects where not loadable.

We where able to track this down to llvm-strip with default arguments
creating a shared object that doesn't load correctly. It works if we
switch from not passing args to llvm-strip to pass -strip-all-gnu

I built bzip2 and libbz2.so to show this case here:
https://1drv.ms/u/s!Amjta5FRkBbbkiz14aHTRJe03LlL?e=2mGvTN

This is the error we got by using the stripped shared object with
llvm-strip -strip-all:

admin at Netgear-RN212:~/b$ LD_PRELOAD=./libbz2.so.all ./bzip2
ERROR: ld.so: object './libbz2.so.all' from LD_PRELOAD cannot be
preloaded (cannot open shared object file): ignored.
./bzip2: error while loading shared libraries: libbz2.so: cannot open
shared object file: No such file or directory

And with strip-all-gnu it works:
admin at Netgear-RN212:~/b$ LD_PRELOAD=./libbz2.so.all_gnu ./bzip2
bzip2: I won't write compressed data to a terminal.
bzip2: For help, type: `bzip2 --help'.

This only seems to happen on Linux-armv7hf - we haven't seen this on
any of the intel platforms.

Thanks,
Tobias