public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Florian Weimer <fweimer@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	libc-alpha@sourceware.org, gdb-patches@sourceware.org,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Kevin Buettner <kevinb@redhat.com>
Subject: Re: [PATCH glibc] nptl_db: different libpthread/ld.so load orders (bug 27744)
Date: Fri, 16 Apr 2021 17:33:14 +0100	[thread overview]
Message-ID: <a165a92e-23b5-5b1b-31e1-6a878737932d@palves.net> (raw)
In-Reply-To: <87fszqnqi3.fsf@oldenburg.str.redhat.com>

On 16/04/21 17:28, Florian Weimer wrote:
> * Pedro Alves:
> 
>> IIRC, the order which libraries are loaded by GDB hasn't changed.  The
>> issue is that until recently (before glibc 1daccf403b1b), the stacks
>> lists lived in libpthread (stack_used/__stack_user), so the fact that
>> GDB loaded libthread_db.so before ld.so's symbols were loaded didn't
>> make a difference.  Now they were moved to ld.so, so libthread_db.so
>> can't find them until GDB reads the ld.so symbols.  Is this assessment
>> correct?
> 
> Yes, I believe this is what happens.
> 

OK, I believe what is confusing in your commit log was the reference to
two different kinds of "loaded":

  "libthread_db is loaded once GDB encounters libpthread, and at this
  point, ld.so may not have been loaded yet. "

The first loaded is about GDB dlopening libthread_db.so.  The second loaded
refers to reading symbols -- ld.so has been loaded by the inferior already
at that point.

It would be clearer as:

  "libthread_db is loaded once GDB encounters libpthread, and at this
  point, ld.so's symbols may not have been read by GDB yet. "

If I understood that correctly, then the following sentence is also a bit confusing:

  "As a result, _rtld_global cannot be accessed by regular means from libthread_db."

Because that sounds to me like you were perhaps talking about some magic means to
reference globals, some magic relocations, or some other magic voodoo only understood
by glibc experts.

Pedro Alves

> I assume that ldd shows objects in link map order, the it looks like
> this:
> 
> $ ldd /usr/bin/python3
> 	linux-vdso.so.1 (0x00007fff1f8d5000)
> 	libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007f3fd7782000)
> 	libc.so.6 => /lib64/libc.so.6 (0x00007f3fd75b7000)
> 	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3fd7595000)
> 	libdl.so.2 => /lib64/libdl.so.2 (0x00007f3fd758e000)
> 	libutil.so.1 => /lib64/libutil.so.1 (0x00007f3fd7589000)
> 	libm.so.6 => /lib64/libm.so.6 (0x00007f3fd7443000)
> 	/lib64/ld-linux-x86-64.so.2 (0x00007f3fd7af7000)
> 
> Thanks,
> Florian
> 


  reply	other threads:[~2021-04-16 16:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16 15:56 Florian Weimer
2021-04-16 16:07 ` Simon Marchi
2021-04-16 16:12   ` Florian Weimer
2021-04-16 16:25   ` Pedro Alves
2021-04-16 16:28     ` Florian Weimer
2021-04-16 16:33       ` Pedro Alves [this message]
2021-04-16 16:43         ` Florian Weimer
2021-04-16 16:47           ` Pedro Alves
2021-04-16 16:53             ` Simon Marchi
2021-04-16 17:18               ` Pedro Alves
2021-04-16 17:26                 ` Florian Weimer
2021-04-16 17:33                 ` Simon Marchi
2021-04-16 18:29                   ` Pedro Alves
2021-04-16 18:35                   ` Florian Weimer
2021-04-16 17:28             ` Florian Weimer
2021-04-16 17:43               ` Pedro Alves
2021-04-19  9:06                 ` Florian Weimer

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=a165a92e-23b5-5b1b-31e1-6a878737932d@palves.net \
    --to=pedro@palves.net \
    --cc=emil.l.velikov@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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).