This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linux: Variable dynamic linking


Mike Frysinger wrote:
>> 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.
>> Then ld.so is called to do the rest of dynamic loading.
>>
>> ...
>> 1) Will this work?

> anything is possible of course, but what you want to do is far from practical 
> and most likely will be full of bugs and require a lot of work for little 
> return.
> 

Hello.

The reason why I again started to work on this is that I found out that
even "portable" Linux applications ("copy them on an USB stick and use
them on any Linux computer") will not work on even quite recent Linux
versions - just because of this dynamic library problem.

I managed to write a tool that is capable of "linking" such executables.
In the background still "/usr/bin/ld" is used for the "final" linking.
The size difference is only about 5 to 7 kiB compared to a dynamically
linked executable (in the case of a simple X11 application this is
nearly 300 kiB less than a statically linked executable; for a "Hello
World" it is about 75 kiB less than the static executable). The tool
allows to link in some libraries statically and other libraries dynamically.

I tested a simple X11 application linked with my tool using a quite
recent Linux and using one of the first Linux versions supporting the
ELF file format (year 1995) - The executable works on both Linux versions!

Btw.: Using commands whose interface changed (example: "extern int
errno;" -> "#define errno (*__errno_location());") will of course not work.

Is anyone interested in my work?
Are there other possibilities to get rid of the "portable application"
problem?

Martin



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]