public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andrea Monaco <andrea.monaco@autistici.org>
To: libc-alpha@sourceware.org
Subject: GNU/Hurd: ld.so.1 crashes while resolving symbols
Date: Wed, 15 Dec 2021 19:30:19 +0100	[thread overview]
Message-ID: <87y24lwwjo.fsf@autistici.org> (raw)


After successfully building latest glibc, I test it with the following:

  GLIBC=/root/glibc/build

  GCONV_PATH=${GLIBC}/iconvdata LD_DEBUG=all LC_ALL=C
  ${GLIBC}/elf/ld.so.1 --library-path
  ${GLIBC}:${GLIBC}/math:${GLIBC}/elf:${GLIBC}/dlfcn:${GLIBC}/nss:${GLIBC}/nis:${GLIBC}/rt:${GLIBC}/resolv:${GLIBC}/crypt:${GLIBC}/nptl:${GLIBC}/dfp:${GLIBC}/mach:${GLIBC}/hurd
  /root/glibc/bug-fstat


Shared objects are found and linked, but then the loader crashes.
Here's the last part of the output


         0:     symbol=__access_noerrno;  lookup in file=./bug-fstat [0]
         0:     symbol=__access_noerrno;  lookup in file=/root/glibc/build/libc.so.0.3 [0]
         0:     binding file /root/glibc/build/elf/ld.so.1 [0] to /root/glibc/build/libc.so.0.3 [0]: normal symbol `__access_noerrno' [GLIBC_PRIVATE]
         0:     symbol=_dl_init_first;  lookup in file=./bug-fstat [0]
         0:     symbol=_dl_init_first;  lookup in file=/root/glibc/build/libc.so.0.3 [0]
         0:     binding file /root/glibc/build/elf/ld.so.1 [0] to /root/glibc/build/libc.so.0.3 [0]: normal symbol `_dl_init_first' [GLIBC_PRIVATE]
         0:     symbol=_dl_signal_error;  lookup in file=./bug-fstat [0]
         0:     symbol=_dl_signal_error;  lookup in file=/root/glibc/build/libc.so.0.3 [0]
         0:     binding file /root/glibc/build/elf/ld.so.1 [0] to /root/glibc/build/libc.so.0.3 [0]: normal symbol `_dl_signal_error' [GLIBC_PRIVATE]
         0:     symbol=__errno_location;  lookup in file=./bug-fstat [0]
         0:     symbol=__errno_location;  lookup in file=/root/glibc/build/libc.so.0.3 [0]
         0:     binding file /root/glibc/build/elf/ld.so.1 [0] to /root/glibc/build/libc.so.0.3 [0]: normal symbol `__errno_location' [GLIBC_2.2.6]
         0:     symbol=__writev;  lookup in file=./bug-fstat [0]
         0:     symbol=__writev;  lookup in file=/root/glibc/build/libc.so.0.3 [0]
         0:     binding file /root/glibc/build/elf/ld.so.1 [0] to /root/glibc/build/libc.so.0.3 [0]: normal symbol `__writev' [GLIBC_2.2.6]
Killed


"bug-fstat" is my test program, but every program I tried does the same,
it crashes right after finding symbol "__writev".

After many printf, I singled out the exact instruction that causes the
crash, which is line 361 in sysdeps/i386/dl-machine.h (marked with >>):


      switch (r_type)
        {
# ifndef RTLD_BOOTSTRAP
        case R_386_SIZE32:
          /* Set to symbol size plus addend.  */
          *reloc_addr += sym->st_size;
          break;
# endif
        case R_386_GLOB_DAT:
        case R_386_JMP_SLOT:
>>        *reloc_addr = value;
          break;


Is this obvious?  Even if I made mistakes while building, I don't think
a crash is expected.



Thanks,

Andrea Monaco


             reply	other threads:[~2021-12-15 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 18:30 Andrea Monaco [this message]
2021-12-16  9:22 ` Samuel Thibault
2021-12-16 23:59 Andrea Monaco

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=87y24lwwjo.fsf@autistici.org \
    --to=andrea.monaco@autistici.org \
    --cc=libc-alpha@sourceware.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).