mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: add notion of multiple compilation units per package
As we move the debug_line generation into the compiler, we need to upgrade the notion of compilationUnit to not just be on a per package basis. That won't be the case as it will be impossible for all compilationUnits to have the same set of files names used to build the debug_lines table. (For example, assembled files in a package don't know about any files but themselves, so the debug_lines table could only reference themseves. As such, we need to break the 1:1 relationship between compUnit and package.) Change-Id: I2e517bb6c01de0115bbf777af828a2fe59c09ce8 Reviewed-on: https://go-review.googlesource.com/c/go/+/189618 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>
This commit is contained in:
parent
d979ac33a2
commit
78a3734714
9 changed files with 173 additions and 145 deletions
|
|
@ -1624,6 +1624,9 @@ func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string,
|
|||
c4 := bgetc(f)
|
||||
f.MustSeek(start, 0)
|
||||
|
||||
unit := &sym.CompilationUnit{Lib: lib}
|
||||
lib.Units = append(lib.Units, unit)
|
||||
|
||||
magic := uint32(c1)<<24 | uint32(c2)<<16 | uint32(c3)<<8 | uint32(c4)
|
||||
if magic == 0x7f454c46 { // \x7F E L F
|
||||
ldelf := func(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
|
||||
|
|
@ -1770,7 +1773,7 @@ func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string,
|
|||
default:
|
||||
log.Fatalf("invalid -strictdups flag value %d", *FlagStrictDups)
|
||||
}
|
||||
c := objfile.Load(ctxt.Arch, ctxt.Syms, f, lib, eof-f.Offset(), pn, flags)
|
||||
c := objfile.Load(ctxt.Arch, ctxt.Syms, f, lib, unit, eof-f.Offset(), pn, flags)
|
||||
strictDupMsgCount += c
|
||||
addImports(ctxt, lib, pn)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue