Linux: Variable dynamic linking

Martin Rosenau martin@rosenau-ka.de
Mon May 4 19:21:00 GMT 2009


Hello everyone.

I'm not sure if I am correct here so sorry if this email is wrong here.

I'm currently working on a software for Linux that should be distributed 
in binary form because the user should not need to link the software 
himself.

Unfortunately under Linux the dynamic library names are changing (e.g. 
libc.so.5, libc.so.6 / ld-linux.so.1, ld-linux.so.2 / ...).

So my idea is to write a special statically-linked code that first 
searches the library directories for library files. The file contains 
only the prefixes of the library names (e.g. "ld-linux.so.*" and 
"libc.so.*"). Once the library files and the interpreter (ld.so) has 
been found the code modifies the application (in RAM, not on disk) so 
that the version number is added to the prefixes (libc.so.* => 
libc.so.6). It maps in ld.so (ld-linux.so.x) and fakes an environment 
that makes ld.so think a dynamically linked application is being loaded. 
Then ld.so is called to do the rest of dynamic loading.

My questions are:
1) Will this work? - It makes - of course - only sense if it works under 
different Linux versions.
2) Is such a feature or a similar one planned for GNU binutils' "ld"?
3) Is there another method to distribute binary files that work across 
different Linux versions (linking statically would be one possibility 
but the file sizes are large...)?

Thank you very much.

Martin




More information about the Binutils mailing list