]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.link] cmd/link: use function address directly in pclntab generation
authorCherry Zhang <cherryyz@google.com>
Thu, 16 Apr 2020 02:23:41 +0000 (22:23 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 20 Apr 2020 14:20:16 +0000 (14:20 +0000)
commitc364079a533c172bd071af38b6f6ffd7dc68186d
tree6ff3aeb81feaccabf40142a0c2986c7a31c12b73
parent93c9a3bd387f561dd07e4811602b0755276444ee
[dev.link] cmd/link: use function address directly in pclntab generation

If we are internal linking a static executable, in pclntab
generation, the function addresses are known, so we can just use
them directly instead of emitting relocations.

For external linking or other build modes,  we are generating a
relocatable binary so we still need to emit relocations.

Reduce some allocations: for linking cmd/compile,

name           old alloc/op   new alloc/op   delta
Pclntab_GC       38.8MB ± 0%    36.4MB ± 0%   -6.19%  (p=0.008 n=5+5)

TODO: can we also do this in DWARF generation?

Change-Id: I43920d930ab1da97c205871027e01844a07a5e60
Reviewed-on: https://go-review.googlesource.com/c/go/+/228478
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/ld/target.go