public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Understanding the default dynamic interpreter used by binutils/gcc....
@ 2002-07-09 12:43 Steven J. Hill
  2002-07-09 13:48 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Steven J. Hill @ 2002-07-09 12:43 UTC (permalink / raw)
  To: binutils, gcc

I am trying to understand the mechanism by with the dynamic linker/loader
fully-qualified name is placed in the '.interp' section. In the binutils,
the 'bfd/elf[32|64]-[ARCH].c' file has a #define ELF_DYNAMIC_INTERPRETER
that gets used in '_bfd_mips_elf_create_dynamic_sections'.

I am interested in the MIPS cross tools and hence we have:

    #define ELF_DYNAMIC_INTERPRETER(abfd) \
       (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" : \
        ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" : \
        "/usr/lib/libc.so.1")

However, gcc has the following in its 'specs' file:

     %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}

For little endian Linux platforms, '/lib/ld.so.1' clearly shows up in
all the dynamic binaries. Why isn't '/lib/ld.so.1' used as the default
case in the above? Secondly, for all the other architectures the path
seems to be invalid. In the i386 case, ELF_DYNAMIC_INTERPRETER is
defined as '/usr/lib/libc.so.1' which on my RH7.2 system does not exist
except for '/usr/lib/libc.so' which contains:

    /* GNU ld script
       Use the shared library, but some functions are only in
       the static library, so try that secondarily.  */
    GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )

Would someone please just give me a quick explanation of the mechanism
that places the final interpreter path/pathname into the output binary's
'.interp' section. Thanks so much.

-Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Understanding the default dynamic interpreter used by binutils/gcc....
  2002-07-09 12:43 Understanding the default dynamic interpreter used by binutils/gcc Steven J. Hill
@ 2002-07-09 13:48 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2002-07-09 13:48 UTC (permalink / raw)
  To: Steven J. Hill; +Cc: binutils, gcc

"Steven J. Hill" <sjhill@realitydiluted.com> writes:

> Would someone please just give me a quick explanation of the mechanism
> that places the final interpreter path/pathname into the output binary's
> '.interp' section. Thanks so much.

The -dynamic-linker option passed to ld overrides ld's default value
for the dynamic linker.

If gcc does not pass a -dynamic-linker option, the default will come
from ELF_INTERPRETER_NAME in the linker emulation, if it is defined.
In the sources this will be seen in the ld/emulparams file.  Only a
couple of emulations define this.

Otherwise, the default will come from ELF_DYNAMIC_INTERPRETER defined
in bfd.  This value is normally specified in the ELF processor
supplement, when there is one.  Most free operating systems use
different values, and typically arrange for gcc to pass the right
value using the -dynamic-linker option.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-09 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-09 12:43 Understanding the default dynamic interpreter used by binutils/gcc Steven J. Hill
2002-07-09 13:48 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).