• Pietro Gagliardi's avatar
    debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for… · f5b600f7
    Pietro Gagliardi authored
    debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols and (*File).DynamicSymbols, and formalize symbol order.
    
    Added a complement to (*File).Symbols for the dynamic symbol table.
    Would be useful, for instance, if seraching for certain shared objects
    compatible with certain libraries (for instance, LADSPA requires an
    exported symbol "ladspa_descriptor").
    
    Added a variable ErrNoSymbols that canonicalizes a return from
    (*File).Symbols and (*File).DyanmicSymbols if the file has no symbols.
    
    Added tests for both (*File).Symbols and (*File).DynamicSymbols;
    there was never a test for (*File).Symbols at all. A small C program using
    libelf, included in the test data, was used to produce the golden
    symbols to compare against.
    
    As part of the requirements for testing, (*File).Symbols and (*File).DynamicSymbols now document the order in which the symbol tables are returned (in the order the symbols appear in the file).
    
    All tests currently pass.
    
    LGTM=iant
    R=golang-codereviews, iant
    CC=golang-codereviews
    https://golang.org/cl/107530043
    f5b600f7
file.go 21.2 KB