Skip to content

Commit d93bea0

Browse files
Mark Freemangopherbot
authored andcommitted
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>
1 parent 2a29cdd commit d93bea0

File tree

1 file changed

+37
-2
lines changed
  • src/cmd/compile/internal/noder

1 file changed

+37
-2
lines changed

src/cmd/compile/internal/noder/doc.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ determines its index in the series.
2424
Payload = SectionString
2525
SectionMeta
2626
SectionPosBase
27-
SectionPkg // TODO(markfreeman) Define.
27+
SectionPkg
2828
SectionName // TODO(markfreeman) Define.
2929
SectionType // TODO(markfreeman) Define.
3030
SectionObj // TODO(markfreeman) Define.
@@ -61,7 +61,7 @@ for all exported objects it contains.
6161
6262
PublicRoot = Relocs
6363
[ SyncPublic ] // TODO(markfreeman): Define.
64-
PackageRef // TODO(markfreeman): Define.
64+
PkgRef
6565
[ HasInit ]
6666
ObjectRefCount // TODO(markfreeman): Define.
6767
{ ObjectRef } // TODO(markfreeman): Define.
@@ -101,6 +101,41 @@ without a PosBase have no line or column.
101101
Uint64 ] // column
102102
.
103103
104+
## Package Section
105+
The package section holds package information. It is a series of Pkg
106+
elements.
107+
108+
SectionPkg = { Pkg } .
109+
110+
A Pkg element contains a (path, name) pair and a series of imported
111+
packages. The below package paths have special meaning.
112+
113+
+--------------+-----------------------------------+
114+
| package path | indicates |
115+
+--------------+-----------------------------------+
116+
| "" | the current package |
117+
| "builtin" | the fake builtin package |
118+
| "unsafe" | the compiler-known unsafe package |
119+
+--------------+-----------------------------------+
120+
121+
Pkg = Relocs
122+
[ SyncPkgDef ] // TODO(markfreeman): Define.
123+
StringRef // path
124+
// The below is ommitted for the special package paths
125+
// "builtin" and "unsafe".
126+
[ StringRef // name
127+
Imports ]
128+
.
129+
Imports = Uint64 // the number of declared imports
130+
{ PkgRef } // references to declared imports
131+
.
132+
133+
Note, a PkgRef is *not* equivalent to Ref[Pkg] due to an extra marker.
134+
135+
PkgRef = [ SyncPkg ] // TODO(markfreeman): Define.
136+
Ref[Pkg]
137+
.
138+
104139
# References
105140
A reference table precedes every element. Each entry in the table
106141
contains a section / index pair denoting the location of the referenced

0 commit comments

Comments
 (0)