mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link, cmd/internal/goobj2: adopt new DWARF compilation unit logic with new object file
The dev.link branch was not sync'd with the new DWARF compilation unit logic change on the master branch, and the new object file format didn't support this. This CL adds the new DWARF CU and file table support to the new object file format. In the old object file, the DWARF file table is a separate section. For now, we do the same with the new object file, keeping it as a separate block. While here, also refactor the loader code so it is easier for the loader to carry per-object informations. Change-Id: I4c317941fc0a5831acbc11ce8c2a8b7421471372 Reviewed-on: https://go-review.googlesource.com/c/go/+/198198 Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
0d7404c852
commit
65a649c565
5 changed files with 184 additions and 107 deletions
|
|
@ -403,11 +403,7 @@ func (ctxt *Link) loadlib() {
|
|||
|
||||
if *flagNewobj {
|
||||
// Add references of externally defined symbols.
|
||||
for _, lib := range ctxt.Library {
|
||||
for _, r := range lib.Readers {
|
||||
objfile.LoadRefs(ctxt.loader, r.Reader, lib, ctxt.Arch, ctxt.Syms, r.Version)
|
||||
}
|
||||
}
|
||||
objfile.LoadRefs(ctxt.loader, ctxt.Arch, ctxt.Syms)
|
||||
|
||||
// Load cgo directives.
|
||||
for _, p := range ctxt.cgodata {
|
||||
|
|
@ -550,11 +546,7 @@ func (ctxt *Link) loadlib() {
|
|||
|
||||
// For now, load relocations for dead-code elimination.
|
||||
if *flagNewobj {
|
||||
for _, lib := range ctxt.Library {
|
||||
for _, r := range lib.Readers {
|
||||
objfile.LoadReloc(ctxt.loader, r.Reader, lib, r.Version, ctxt.LibraryByPkg)
|
||||
}
|
||||
}
|
||||
objfile.LoadReloc(ctxt.loader)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2545,11 +2537,7 @@ func dfs(lib *sym.Library, mark map[*sym.Library]markKind, order *[]*sym.Library
|
|||
|
||||
func (ctxt *Link) loadlibfull() {
|
||||
// Load full symbol contents, resolve indexed references.
|
||||
for _, lib := range ctxt.Library {
|
||||
for _, r := range lib.Readers {
|
||||
objfile.LoadFull(ctxt.loader, r.Reader, lib, r.Version, ctxt.LibraryByPkg)
|
||||
}
|
||||
}
|
||||
objfile.LoadFull(ctxt.loader)
|
||||
|
||||
// For now, add all symbols to ctxt.Syms.
|
||||
for _, s := range ctxt.loader.Syms {
|
||||
|
|
@ -2557,6 +2545,9 @@ func (ctxt *Link) loadlibfull() {
|
|||
ctxt.Syms.Add(s)
|
||||
}
|
||||
}
|
||||
|
||||
// Drop the reference.
|
||||
ctxt.loader = nil
|
||||
}
|
||||
|
||||
func (ctxt *Link) dumpsyms() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue