I have a weird Linux system where most of the software is compiled against Glibc and some others against uClibc.
Since the Linux is a standard distro when I launch and executable the standard dynamic linker is invoked (/lib/ld.so.1) from glibc.
I'm looking for a way to specify the dynamic loader before launching any executable so when I want to run software which was compiled against uClibc I can define the launching mechanism to use uClibc dynamic loader (/lib/ld-uClibc.so.0).
Any ideas?
LD_ASSUME_KERNEL can be used to cause the dynamic linker to assume that it is running on a system with a different kernel ABI version. For example, the following command line causes the dynamic linker to assume it is running on Linux 2.2.
LD_BIND_NOW : Dynamic Libraries can be instructed to load at system startup by setting the LD_BIND_NOW variable with ld. so, the dynamic linker/loader. This means that the first time that your code calls a function in a dynamic library, the runtime environment calls the dynamic linker.
LD_PRELOAD. A list of additional, user-specified, ELF shared libraries to be loaded before all others. The items of the list can be separated by spaces or colons. This can be used to selectively override functions in other shared libraries.
/lib/ld.so a.out dynamic linker/loader /lib/ld-linux.so.{1,2} ELF dynamic linker/loader /etc/ld.so.cache. File containing a compiled list of directories in which to search for libraries and an ordered list of candidate libraries.
I'm looking for a way to specify the dynamic loader before launching any executable so when I want to run software which was compiled against uClibc
You should be specifying the correct dynamic loader while building against uClibc
, using the linker --dynamic-linker
argument. E.g.
gcc -nostdlib -Wl,--dynamic-linker=/lib/ld-uClibc.so.0 \
/lib/uClibc-crt1.o main.o -L/path/to/uClibc -lc
Just put the full path to the dynamic linker before calling the executable, for example:
/home/x20/tools/codescape-2016.05-3-mips-mti-linux-gnu/2016.05-03/sysroot/mipsel-r2-hard/lib64/ld-2.20.so out.gn/mipsel/d8
d8 is the binary we want to execute and ld-2.20.so is the dynamic linker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With