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

Using a different dynamic linker at compile-time vs. run-time


I am attempting to use an old compiler/libraries/etc. on a new system
in order to generate binaries that will run on an old system.

Specifically, I have a copy of the compiler, linker, etc. from Red Hat
Enterprise Linux 4.x, and I want to run that toolchain on a newer
platform in order to generate RHEL 4 binaries.

With the proper combination of "-B", "--sysroot", "-L", etc. options,
I actually have this working...  Except for one thing.

I want to tell the linker to use /oldroot/lib64/ld-linux-x86-64.so.2
as the dynamic linker at compile time, but I still want
"/lib64/ld-linux-x86-64.so.2" to appear in the ELF header of the
resulting executable (so that the "system" dynamic linker is used at
run time).

The GNU ld "--dynamic-linker=" option lets me specify a dynamic
linker, but unfortunately, it applies both to compile time and to run
time; that is, it both uses that dynamic linker to build (good for me)
and it puts that into the ELF header (bad for me).

Put another way, I can easily use different paths for .so files at
build time and run time; indeed, this is the default behavior of .so
files.  The one exception, as far as I can tell, is the dynamic
linker.

My use case actually does need this because the RHEL 5 dynamic linker,
while run-time compatible with RHEL 4, is not compile-time compatible.
 Nor would I expect it to be.

So, am I missing an option to GNU ld?  If not, is this a feature the
binutils maintainers would be willing to contemplate?

Thank you!

 - Pat


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