[PATCH] Export stack_used as __stack_used

Florian Weimer fweimer@redhat.com
Fri Jun 17 20:31:00 GMT 2016


On 06/17/2016 10:17 PM, Gary Benson wrote:
> Gary Benson wrote:
>> Florian Weimer wrote:
>>> On 06/17/2016 01:37 PM, Gary Benson wrote:
>>>> This commit renames "stack_used" as "__stack_used" and changes it
>>>> from a static variable in allocatestack.c to an internally
>>>> exported symbol available to all nptl source files.  This fixes
>>>> bug 17629 (and thus GDB PR 9635).
>>>
>>> What do you mean by “export”?  The __ prefix suggests that you want
>>> to export it as a symbol (probably GLIBC_PRIVATE), but I think you'd
>>> need to update nptl/Versions in this case.
>>
>> No, I don't need that, it needs to be visible outside allocatestack.c
>> but it doesn't need to be visible in, e.g., the output of "objdump -T".
>>
>>> If the variable remains nptl-internal, I expect that you could turn
>>> it into a hidden symbol, and keep its current name.
>>
>> I may be wrong but I think its the rename that fixes the GDB bug.
>>
>> If it's visible outside of allocatestack.c (i.e. it's not "static")
>> then it should be named with a double-underscore, no?
>
> Oh, hang on, libthread_db looks it up _by_name_.  How is that working
> currently?

It seems that libpthread_db calls ps_pglobal_lookup, which is provided 
by the “application” (so GDB).  The mechanism is a bit weird: it almost 
looks as if someone thought about caching the name-based lookups in an 
array (with an index known at compile-time), but then never wrote the 
code to use a cache.

We check that the symbols can be found in the .symtab section (so via 
debugging information, I assume, not .dynsym).

Florian



More information about the Libc-alpha mailing list