]> Cypherpunks repositories - gostls13.git/commit
cmd/ld: fix symbol table sorting
authorRuss Cox <rsc@golang.org>
Thu, 28 Feb 2013 21:21:58 +0000 (16:21 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 28 Feb 2013 21:21:58 +0000 (16:21 -0500)
commit40ed753ebd6b74747816fde7b130116ff7ef9580
treef62d94145914f754252d7e9857ed37a95d36b7e3
parent1bf66f081fb34893235a02b29a8eb559e17c248e
cmd/ld: fix symbol table sorting
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
src/cmd/ld/data.c
src/cmd/ld/ldelf.c
src/cmd/ld/ldmacho.c
src/cmd/ld/ldpe.c
src/cmd/ld/lib.h
src/pkg/runtime/symtab.c