Re: Using libthread_db.so with single-threaded programs, for TLS access
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel,gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <[email protected]> |
Hi Carlos, On 09/18/2017 02:17 PM, Carlos O'Donell wrote: > On 09/13/2017 06:02 PM, Pedro Alves wrote: > From the glibc side I think your patch goes in a very desirable direction. > We want this to look the same if there is one thread (main thread 0) or > more than one thread. Therefore the abstraction is valuable. Great to hear, thanks! > At the implementation level I would want to see the changes to dl-tls.c > much more restricted. Including db_info.c seems like just an expedient > airplane hack. We need a cleaner way to define the symbols you need. Yeah, I was aiming for the "minimal viable product", and just followed what nptl/pthread_create.c does. It's possible that we could trim the defined symbols, I haven't looked much beyond the surface. I suspect that nptl/pthread_create.c includes ../nptl_db/db_info.c directly for static links (-static). I.e., so that the thread_db-related symbols are defined (and are only defined) with programs that call pthread_create. It's possible that my prototype breaks -static linking with multiple definition errors, I haven't tried it. > > So the patch isn't ready, but the idea is solid. I don't have time to look > at this right now, but I will in maybe a month (yes my queue is that deep > right now). Likewise. If someone more familiar with glibc internals wants to run with this, they're more than welcome. Thanks, Pedro Alves