This is the mail archive of the binutils@sources.redhat.com 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]

Understanding the default dynamic interpreter used by 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


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