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] |
I have an application which makes use of LD_PRELOAD and I recently discovered how to make it work with either 32- or 64-bit programs by using the dynamic string token '$LIB' in the path. According to Ulrich Drepper's document http://www.akkadia.org/drepper/dsohowto.pdf, $LIB will expand to "/lib" for a 32-bit process and /lib64 for a 64-bit process, they enabling me to maintain both flavors and find the appropriate one in all cases. I implemented this in my code and it works great. Problem solved. However, I've just found that while this works fine on most Linux variants (e.g. RHEL 5), it fails on Ubuntu 10.04 and 10.10 (at least). I've written up a little test case (attached, and output below). As you can see the $LIB token simply does not get expanded and the dynamic linker tries to open the '$LIB' string literally. The first two cases, as well as the second two cases, should behave identically and do on other distros: % make ============================== LD_PRELOAD='$LIB/ldlab.so' ./hello32 ERROR: ld.so: object '$LIB/ldlab.so' from LD_PRELOAD cannot be preloaded: ignored. Hello 32-bit world! ============================== LD_PRELOAD='lib/ldlab.so' ./hello32 = Starting Hello 32-bit world! = Ending ============================== LD_PRELOAD='$LIB/ldlab.so' ./hello64 ERROR: ld.so: object '$LIB/ldlab.so' from LD_PRELOAD cannot be preloaded: ignored. Hello 64-bit world! ============================== LD_PRELOAD='lib64/ldlab.so' ./hello64 = Starting Hello 64-bit world! = Ending Is this a build bug? A configurable not turned on by default? A feature removed in an excess of caution? Any clues? Thanks, AK
Attachment:
ldlab.tar.gz
Description: GNU Zip compressed data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |