[PING] [rfc]: Framework for looking up multiply defined global symbols in shared libraries

Markus Deuling deuling@de.ibm.com
Thu May 10 14:52:00 GMT 2007


Daniel Jacobowitz wrote:
>> As an example I implemented a special lookup routine for ELF shared libraries
>> linked with -Bsymbolic. While the focus is within such a library, the global 
>> symbol lookup shall first search for the symbol within this library and then
>> go through the main executable if not found.
> 
> Is this the point of the patch, or just an example?  I mean, what else
> would you use this for besides -Bsymbolic?
> 
> There's some benefit to looking up the right symbol, e.g. for "print
> foo()".  But for breakpoints, I still think the way to go is to
> breakpoint all functions with the same name and/or allow the user to
> specify a copy explicitly (apparently DBX does the latter).
> 

The lookup for the '-Bsymbolic' library is just one example.

ELF says that the symbol resolution algorithm for that kind of library shall start
within the library instead of the main executable. If this lookup fails the "normal"
lookup starting in the main executable shall take place.

There'll be another patch using that lookup framework for the combined debugger for Cell.
If GDB debugs a Cell binary and stands in a SPU thread (which GDB thinks of as a library) 
then the lookup of a symbol would prefer the symbol in the main executable (in the PPE thread)
if available. The second patch using that framework makes sure that a symbol lookup within
a SPU thread prefers symbols from that SPU thread.

This framework also makes it possible for other library handlers (sorry, I don't know any examples now) to 
install their own callbacks if the want to have own algorithms for symbol lookup.


-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com



More information about the Gdb-patches mailing list