help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use a different ld-linux.so?


From: Paul D. Smith
Subject: How to use a different ld-linux.so?
Date: 28 Jun 2004 12:39:28 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Hi all;

I have a need to use a different runtime linker (ld-linux.so) for some
of my applications.  I _don't_ want to change the executables themselves
(changing the path to the runtime linker in the ELF image for example).

I know that I can just run my application as an argument to ld-linux.so,
and that actually does work very well.  But, I am left with two
problems:

  * Some of my applications fork/exec other programs, and those other
    programs also need to use the other runtime linker.  Just as I don't
    want to change the ELF image, I certainly don't want to have to
    recompile the programs to exec the runtime linker!

  * Debugging: I can't debug because I can't find a way to convince GDB
    to invoke the program-to-be-debugged using an alternative runtime
    linker.

I was wondering if anyone has any ideas about how to do this?  I checked
the man pages and didn't see anything (I was looking for something like
an environment variable that ld-linux.so might obey to re-exec a
different version, or some such thing--not likely, I know).

If there's nothing like that available another idea is to use LD_PRELOAD
to install a private version of the execve() system call, which would
set the alternative ld-linux.so as the first argument.  Any thoughts on
this approach?  Do you think it would solve the GDB problem as well?
I'm going to proceed to work on this idea but I wanted to see if anyone
had other thoughts about it.



PS. In case anyone's curious, I'm trying to run some programs natively
    on my desktop system which were actually compiled for a different
    system, and the native and target systems have different versions of
    glibc installed.  I can't change either of the versions of glibc,
    but I do have the complete root filesystem of the target box in a
    subdirectory of my native box and I can use LD_LIBRARY_PATH, etc. to
    use them... I just need a way to get the runtime environment to
    initialize properly.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@nortelnetworks.com>   HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]