• Russ Cox's avatar
    cmd/ld: fix symbol table sorting · 40ed753e
    Russ Cox authored
    runtime: double-check that symbol table is sorted
    
    If the symbol table is unsorted, the binary search in findfunc
    will not find its func, which will make stack traces stop early.
    When the garbage collector starts using the stack tracer,
    that would be a serious problem.
    
    The unsorted symbol addresses came from from two things:
    
    1. The symbols in an ELF object are not necessarily sorted,
       so sort them before adding them to the symbol list.
    
    2. The __i686.get_pc_thunk.bx symbol is present in multiple
       object files and was having its address adjusted multiple
       times, producing an incorrect address in the symbol table.
    
    R=golang-dev, iant
    CC=golang-dev
    https://golang.org/cl/7440044
    40ed753e
ldmacho.c 20.2 KB