Unix/Linux Go Back    

Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

LD_PRELOAD on x86_64 gives error from ld.so


Thread Tools Search this Thread Display Modes
Old Unix and Linux 03-22-2008   -   Original Discussion by Manish Mukherje
Manish Mukherje Manish Mukherje is offline
Registered User
Join Date: Mar 2008
Last Activity: 23 March 2008, 7:00 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
LD_PRELOAD on x86_64 gives error from ld.so

I have implemented an interposer for open() and open64() system call.

This interposer is implemented in interposer.c and I have compiled it in a shared library (libinterposer.so) using the following commands:

gcc -g -fPIC -s -o interposer.o -c interposer.c
gcc -s -g -shared -nostartfiles -o libinterposer.so interposer.o -ldl

This interposer is working on i686 architecture. When I say working, it means, I can set the LD_PRELOAD environment variable to 'libinterposer.so' and intercept all 'open' system calls.

However when I repeat the exact same steps on a x86_64, I get errors from ld.so like so:

manmukhe@sjc-lds-133:[lbt]echo $LD_PRELOAD

manmukhe@sjc-lds-133:[lbt]touch x.c
ERROR: ld.so: object 'libinterposer.x86_64.so' from LD_PRELOAD cannot be preloaded: ignored.

The file types for libinterposer.so and touch are as follows:

manmukhe@sjc-lds-133:[lbt]file libinterposer.x86_64.so
libinterposer.x86_64.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), stripped

manmukhe@sjc-lds-133:[lbt]file /bin/touch
/bin/touch: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped

Here are my questions:
1. What am I doing wrong? Why am I getting the ld.so error?
2. Is there any way to suppress the ld.so errors?
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Declaring LD_PRELOAD system wide for dynamic loading mzeeshan UNIX for Advanced & Expert Users 0 07-24-2009 05:27 AM
Preloading libraries.. LD_PRELOAD manchester UNIX for Advanced & Expert Users 3 02-19-2009 08:15 AM
What does LD_PRELOAD signify? shriashishpatil UNIX for Advanced & Expert Users 4 02-02-2009 11:22 AM
LD_PRELOAD on HP UX? psreddy1234 HP-UX 2 11-10-2008 05:30 AM
confused X86_64 and AIX eternalflame Linux 2 04-03-2008 05:21 AM

All times are GMT -4. The time now is 09:54 AM.