Skip to content

Commit 901ac46

Browse files
committed
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 <[email protected]> Run-TryBot: Josh Bleecher Snyder <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent d542765 commit 901ac46

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/cmd/link/internal/ld/link.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,18 @@ func (ctxt *Link) MaxVersion() int {
148148
}
149149

150150
// generatorFunc is a convenience type.
151-
// Linker created symbols that are large, and shouldn't really live in the
152-
// heap can define a generator function, and their bytes can be generated
151+
// Some linker-created Symbols are large and shouldn't really live in the heap.
152+
// Such Symbols can define a generator function. Their bytes can be generated
153153
// directly in the output mmap.
154154
//
155-
// Generator symbols shouldn't grow the symbol size, and might be called in
156-
// parallel in the future.
155+
// Relocations are applied prior to emitting generator Symbol contents.
156+
// Generator Symbols that require relocations can be written in two passes.
157+
// The first pass, at Symbol creation time, adds only relocations.
158+
// The second pass, at content generation time, adds the rest.
159+
// See generateFunctab for an example.
160+
//
161+
// Generator functions shouldn't grow the Symbol size.
162+
// Generator functions must be safe for concurrent use.
157163
//
158164
// Generator Symbols have their Data set to the mmapped area when the
159165
// generator is called.

0 commit comments

Comments
 (0)