Reputation: 1500
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?
Upvotes: 7
Views: 5077
Reputation: 2588
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
Upvotes: 3
Reputation: 213375
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
Upvotes: 6
Reputation: 99993
Looks to me as if you need to set PT_INTERP to point to an alternative interpreter that in turn prefers your prefered ld.so device. See the man page for elf(5). See readelf to dump what you have and see; you are trying to change ld-linux-xxx.so.x to whatever you come up with.
Actually, it looks to me as if you just want to point to your alternative ld.so as the INTERP.
Upvotes: 0