aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMark Freeman <mark@golang.org>2025-05-19 13:16:15 -0400
committerGopher Robot <gobot@golang.org>2025-05-19 12:42:07 -0700
commitd93bea0e59e51c2d85e69f28f09726b5c9fc81d2 (patch)
tree88443cfacab09a734fb39415f24aabec4f161d52 /src/cmd
parent2a29cddec377e2dccb6bceb7a542249ec8ec96b2 (diff)
downloadgo-d93bea0e59e51c2d85e69f28f09726b5c9fc81d2.tar.xz
cmd/compile/internal/noder: document SectionPkg
The package section holds package stubs, which are a package (path, name) pair and a series of declared imports. Change-Id: If2a260c5e0a3522851be9808de46a3f128902002 Reviewed-on: https://go-review.googlesource.com/c/go/+/674175 Auto-Submit: Mark Freeman <mark@golang.org> TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/noder/doc.go39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/noder/doc.go b/src/cmd/compile/internal/noder/doc.go
index f92578a86d..bafdb2ea84 100644
--- a/src/cmd/compile/internal/noder/doc.go
+++ b/src/cmd/compile/internal/noder/doc.go
@@ -24,7 +24,7 @@ determines its index in the series.
Payload = SectionString
SectionMeta
SectionPosBase
- SectionPkg // TODO(markfreeman) Define.
+ SectionPkg
SectionName // TODO(markfreeman) Define.
SectionType // TODO(markfreeman) Define.
SectionObj // TODO(markfreeman) Define.
@@ -61,7 +61,7 @@ for all exported objects it contains.
PublicRoot = Relocs
[ SyncPublic ] // TODO(markfreeman): Define.
- PackageRef // TODO(markfreeman): Define.
+ PkgRef
[ HasInit ]
ObjectRefCount // TODO(markfreeman): Define.
{ ObjectRef } // TODO(markfreeman): Define.
@@ -101,6 +101,41 @@ without a PosBase have no line or column.
Uint64 ] // column
.
+## Package Section
+The package section holds package information. It is a series of Pkg
+elements.
+
+ SectionPkg = { Pkg } .
+
+A Pkg element contains a (path, name) pair and a series of imported
+packages. The below package paths have special meaning.
+
+ +--------------+-----------------------------------+
+ | package path | indicates |
+ +--------------+-----------------------------------+
+ | "" | the current package |
+ | "builtin" | the fake builtin package |
+ | "unsafe" | the compiler-known unsafe package |
+ +--------------+-----------------------------------+
+
+ Pkg = Relocs
+ [ SyncPkgDef ] // TODO(markfreeman): Define.
+ StringRef // path
+ // The below is ommitted for the special package paths
+ // "builtin" and "unsafe".
+ [ StringRef // name
+ Imports ]
+ .
+ Imports = Uint64 // the number of declared imports
+ { PkgRef } // references to declared imports
+ .
+
+Note, a PkgRef is *not* equivalent to Ref[Pkg] due to an extra marker.
+
+ PkgRef = [ SyncPkg ] // TODO(markfreeman): Define.
+ Ref[Pkg]
+ .
+
# References
A reference table precedes every element. Each entry in the table
contains a section / index pair denoting the location of the referenced