Question

I wrote a simple LD_PRELOAD module, compiled on Ubuntu server. Will this preload work on other systems like Solaris, FreeBSD, CentOS and etc. Are there any special issues on some of the OSes?

Was it helpful?

Solution

The LD_PRELOAD mechanism works across all ELF systems (Linux, Solaris, etc...).

In theory the same library could be usable on different operating systems if the architecture is a match (e.g. an i386 library won't work on Solaris SPARC) but there are many pitfalls. For example, many data structures provided by the C library have different sizes and member arrangements and they will be incompatible between operating systems even if the architecture is the same.

If you are very careful about what functions you call in your LD_PRELOAD library then you may be able to create a library that is compatible between operating systems. You will definitely need to test it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top