|
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.
|