From e4e1c6a7aff04a61a202ed1b331ffdfdff5a77cf Mon Sep 17 00:00:00 2001 From: Jeremy Faller Date: Thu, 23 Jul 2020 15:15:26 -0400 Subject: [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 TryBot-Result: Gobot Gobot Reviewed-by: Austin Clements Reviewed-by: Cherry Zhang --- src/cmd/link/internal/sym/compilation_unit.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/cmd/link/internal/sym') 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 -- cgit v1.3