public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Steven J. Hill" <sjhill@realitydiluted.com>
To: binutils@sources.redhat.com,  gcc@gcc.gnu.org
Subject: Understanding the default dynamic interpreter used by binutils/gcc....
Date: Tue, 09 Jul 2002 12:43:00 -0000	[thread overview]
Message-ID: <3D2B3B72.8030205@realitydiluted.com> (raw)

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

             reply	other threads:[~2002-07-09 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-09 12:43 Steven J. Hill [this message]
2002-07-09 13:48 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D2B3B72.8030205@realitydiluted.com \
    --to=sjhill@realitydiluted.com \
    --cc=binutils@sources.redhat.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).