Change ld-linux location

I found out that to load libraries, the executable is opened first /lib/ld-linux-x86-64.so.2

. All shared library loading functions (searching in many paths using rpath, etc.) will only work after loading ld-linux

as this ld-linux

implements those functions.

It felt like the location was ld-linux.so

hardcoded into the executable (calling strings

in my executable leverages this theory). My problem is that on my Linux distribution the compiler (g ++) sets the location ld-linux

to /lib/ld-linux-x86-64.so.2

. While on Ubuntu (which is more popular) it is in /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

.

I was wondering if I could make an executable for ld-linux.so

in /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

(which is also present in my distribution as a symbolic link).

+3


source to share


1 answer


Try adding -Wl,--dynamic-linker=/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

to yours LDFLAGS

.



+6


source







All Articles