aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/sym
diff options
context:
space:
mode:
authorJeremy Faller <jeremy@golang.org>2020-07-23 15:15:26 -0400
committerJeremy Faller <jeremy@golang.org>2020-08-03 17:58:03 +0000
commite4e1c6a7aff04a61a202ed1b331ffdfdff5a77cf (patch)
tree2c05882cdba2747e1c3b169bba526912e0744b6e /src/cmd/link/internal/sym
parent89cf569a45f035bae45553f399880b92ede65f38 (diff)
downloadgo-e4e1c6a7aff04a61a202ed1b331ffdfdff5a77cf.tar.xz
[dev.link] add compilation unit index to func
Not used yet, but add the compilation unit for a function to func. Change-Id: I7c43fa9f1da044ca63bab030062519771b9f4418 Reviewed-on: https://go-review.googlesource.com/c/go/+/244547 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/link/internal/sym')
-rw-r--r--src/cmd/link/internal/sym/compilation_unit.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cmd/link/internal/sym/compilation_unit.go b/src/cmd/link/internal/sym/compilation_unit.go
index d9bfc84936..dc37a36cba 100644
--- a/src/cmd/link/internal/sym/compilation_unit.go
+++ b/src/cmd/link/internal/sym/compilation_unit.go
@@ -10,12 +10,19 @@ import "cmd/internal/dwarf"
// type from the sym package since loader imports sym.
type LoaderSym int
-// CompilationUnit is an abstraction used by DWARF to represent a chunk of
-// debug-related data. We create a CompilationUnit per Object file in a
-// library (so, one for all the Go code, one for each assembly file, etc.).
+// A CompilationUnit represents a set of source files that are compiled
+// together. Since all Go sources in a Go package are compiled together,
+// there's one CompilationUnit per package that represents all Go sources in
+// that package, plus one for each assembly file.
+//
+// Equivalently, there's one CompilationUnit per object file in each Library
+// loaded by the linker.
+//
+// These are used for both DWARF and pclntab generation.
type CompilationUnit struct {
Pkg string // The package name, eg ("fmt", or "runtime")
Lib *Library // Our library
+ PclnIndex int // Index of this CU in pclntab
PCs []dwarf.Range // PC ranges, relative to Textp[0]
DWInfo *dwarf.DWDie // CU root DIE
DWARFFileTable []string // The file table used to generate the .debug_lines