1
0
mirror of https://github.com/golang/go synced 2024-11-24 05:10:19 -07:00

cmd/link: document generator symbols more

And make the existing docs easier to parse.

In particular, document the interaction with relocations.

Change-Id: I97579f88d9248c12e64af723a946959b88d4b674
Reviewed-on: https://go-review.googlesource.com/c/go/+/351112
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Josh Bleecher Snyder 2021-09-20 14:13:07 -07:00
parent d542765896
commit 901ac46df8

View File

@ -148,12 +148,18 @@ func (ctxt *Link) MaxVersion() int {
}
// generatorFunc is a convenience type.
// Linker created symbols that are large, and shouldn't really live in the
// heap can define a generator function, and their bytes can be generated
// Some linker-created Symbols are large and shouldn't really live in the heap.
// Such Symbols can define a generator function. Their bytes can be generated
// directly in the output mmap.
//
// Generator symbols shouldn't grow the symbol size, and might be called in
// parallel in the future.
// Relocations are applied prior to emitting generator Symbol contents.
// Generator Symbols that require relocations can be written in two passes.
// The first pass, at Symbol creation time, adds only relocations.
// The second pass, at content generation time, adds the rest.
// See generateFunctab for an example.
//
// Generator functions shouldn't grow the Symbol size.
// Generator functions must be safe for concurrent use.
//
// Generator Symbols have their Data set to the mmapped area when the
// generator is called.