]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: document generator symbols more
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Sep 2021 21:13:07 +0000 (14:13 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 21 Sep 2021 16:34:40 +0000 (16:34 +0000)
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>
src/cmd/link/internal/ld/link.go

index 13618beff977a5a5aef902edd354bf6a644d7660..64d18bd62c0752ec012160f7a818d5a987d4af5f 100644 (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.