]> Cypherpunks repositories - gostls13.git/commit
cmd/link: rewrite pe symbol table generating code
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 11 Mar 2016 01:19:08 +0000 (12:19 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Sat, 12 Mar 2016 07:07:48 +0000 (07:07 +0000)
commitbb48b864b1c79c586b5807f3c78ab15e75e770e2
treeb441dbdf1255b25eba4b1df71b6f17b0de5416ac
parent77b527e283112d33000990c59e766074c9396292
cmd/link: rewrite pe symbol table generating code

Every go executable has COFF symbol table appended at the end. The table is
used by nm and addr2line and contains all symbols present in the executable.
The table is quite large. For example, my go.exe has 11736 records.

To generate symbol table:
1) we walk "all symbols" list to count symbols we want for the table;
2) we allocate large global array of COFFSym structs (32 bytes each)
   to fit our symbols;
3) we walk "all symbols" list again to fill our array with contents;
4) we iterate over our global array to write all records to the file.

This CL changes all these steps with single step:
- walk "all symbols" list and write each COFF symbol table record to
  the file as we go.

I hope new version is faster and uses less garbage, but I don't know
how to benchmark this.

Change-Id: Ie4870583250131ea4428e0e83a0696c9df1794e0
Reviewed-on: https://go-review.googlesource.com/20580
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
src/cmd/link/internal/ld/pe.go