This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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]

LD_PRELOAD in a multilib environment


Hi,

I'm porting a piece of software that uses LD_PRELOAD to Linux.
Unfortunately Linux (in particular ld.so) seems to have an
architectural flaw in this area. Setting LD_PRELOAD=foobar.so
essentially says "map foobar.so into every new process within the
scope of this environment variable". But in the modern world where
many systems have both 32- and 64-bit libraries, a single variable
cannot possibly be sufficient; you're almost certainly going to
eventually try to load a 32-bit library into a 64-bit process space or
vice versa, which will fail.

Solaris solved this many years ago by adding alternate variables
LD_PRELOAD_32 and LD_PRELOAD_64; as long as you point LD_PRELOAD_32 to
the 32-bit version of libfoo and LD_PRELOAD_64 to the 64-bit version,
things continue to work. I'm surprised to see that this system, or a
different solution, has not been brought into the Linux world. What am
I missing? How do people solve this in Linux?

Thanks,
AK


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