cmd/link: rewrite pe symbol table generating code
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 <a2f0bf29257797dd66800b4fbb9945c3e216c004@golang.org>
Run-TryBot: David Crawshaw <a2f0bf29257797dd66800b4fbb9945c3e216c004@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Run-TryBot: Alex Brainman <54ba58c8441b5eff861de6b4e5ee46baf086b142@gmail.com>

4ad/go,Samurais/go,Cofyc/go,linux-on-ibm-z/go,miolini/go,vsekhar/elastic-go,nawawi/go,ImJasonH/go,suncycheng/go,josharian/go,golang/go,Cofyc/go,ganboing/go-esx,4ad/go,linux-on-ibm-z/go,vanloswang/go,nawawi/go,josharian/go,ImJasonH/go,golang/go,CAFxX/go,theif519/go,4ad/go,codestation/go,golang/go,josharian/go,derekmarcotte/go,derekmarcotte/go,codestation/go,nawawi/go,Samurais/go,golang/go,theif519/go,golang/go,CAFxX/go,ImJasonH/go,CAFxX/go,4ad/go,polyverse-security/go,linux-on-ibm-z/go,suncycheng/go,goodlang/good,ganboing/go-esx,josharian/go,Cofyc/go,ImJasonH/go,derekmarcotte/go,akutz/go,CAFxX/go,polyverse-security/go,theif519/go,golang/go,momchil-velikov/go,suncycheng/go,linux-on-ibm-z/go,josharian/go,vanloswang/go,vanloswang/go,josharian/go,Samurais/go,vsekhar/elastic-go,goodlang/good,CAFxX/go,polyverse-security/go,akutz/go,akutz/go,golang/go,derekmarcotte/go,ganboing/go-esx,vanloswang/go,miolini/go,cloudflare/go,vsekhar/elastic-go,ganboing/go-esx,codestation/go,momchil-velikov/go,derekmarcotte/go,momchil-velikov/go,goodlang/good,ganboing/go-esx,nawawi/go,4ad/go,vsekhar/elastic-go,momchil-velikov/go,ImJasonH/go,miolini/go,derekmarcotte/go,Cofyc/go,cloudflare/go,Samurais/go,cloudflare/go,goodlang/good,miolini/go,suncycheng/go,christopher-henderson/Go,Samurais/go,polyverse-security/go,golang/go,cloudflare/go,Cofyc/go,nawawi/go,cloudflare/go,ganboing/go-esx,ImJasonH/go,polyverse-security/go,polyverse-security/go,akutz/go,ImJasonH/go,linux-on-ibm-z/go,josharian/go,akutz/go,goodlang/good,codestation/go,momchil-velikov/go,cloudflare/go,momchil-velikov/go,vanloswang/go,cloudflare/go,vsekhar/elastic-go,akutz/go,miolini/go,polyverse-security/go,akutz/go,josharian/go,momchil-velikov/go,theif519/go,CAFxX/go,akutz/go,derekmarcotte/go,nawawi/go,CAFxX/go,Samurais/go,Samurais/go,miolini/go,theif519/go,codestation/go,miolini/go,vsekhar/elastic-go,goodlang/good,cloudflare/go,polyverse-security/go,ImJasonH/go,4ad/go,linux-on-ibm-z/go,linux-on-ibm-z/go,nawawi/go,CAFxX/go,vanloswang/go,goodlang/good,vanloswang/go,vsekhar/elastic-go,linux-on-ibm-z/go,Cofyc/go,codestation/go,Cofyc/go,4ad/go,nawawi/go,theif519/go,miolini/go,theif519/go,suncycheng/go,vanloswang/go,4ad/go,momchil-velikov/go,derekmarcotte/go,Cofyc/go,suncycheng/go,theif519/go,codestation/go,suncycheng/go,Samurais/go,ganboing/go-esx,goodlang/good,suncycheng/go,vsekhar/elastic-go,codestation/go,ganboing/go-esx