OpenSolaris

Printable Version Enter a New Search
Bug ID 6475344
Synopsis DTrace needs ELF function and data symbols sorted by address
State 10-Fix Delivered (Fix available in build)
Category:Subcategory compiler:linker
Keywords
Responsible Engineer Ali Bahrami
Reported Against
Duplicate Of
Introduced In
Commit to Fix snv_58
Fixed In snv_58
Release Fixed solaris_nevada(snv_58)
Related Bugs 6509686
Submit Date 26-September-2006
Last Update Date 16-February-2007
Description
This corresponds to

	PSARC 2007/026 ELF symbol sort sections

The ELF .dynsym symbol table, augmented by the .SUNW_ldynsym
symbol table, can be used to map virtual addresses to function
and variable names. This ability is useful to DTrace, and
to debuggers. 

The order of symbols in an ELF symbol table prevent efficient
mapping of an address to a symbol. In DTrace probe context,
it is not possible to compensate by building a separate
efficient representation. Memory cannot be allocated in
probe context, and the impact on the probed process would
be unacceptable even if it could be. It would be a large
improvement if the ELF symbol tables had the function
and variable symbols already sorted by address.

The rules that govern ELF symbol table layout preclude any
such reordering. However, ELF does allow for new section types
to be added to the system. I am proposing to add a new section
that would contain an array of indexes into the combined ldynsym/dynsym
table. These indexes would be sorted such that following the array
in linear order from start to end will supply the function and
data symbols, sorted by increasing address.

The cost of such an auxiliary section is a single machine word per
symbol. Having this sorted array available will allow DTrace to
implement a simple binary search algorithm for symbol lookup and
get O(log n) performance. It can also be used by dladdr(3C) to
replace the current O(n) lookup.
Work Around
N/A
Comments
N/A