mirror of
https://github.com/golang/go
synced 2024-11-23 00:20:12 -07:00
cmd/link: introduce and use peFile.addDWARF
Change-Id: I2c217e03779772605aa0b5a33ef80459333eeebc Reviewed-on: https://go-review.googlesource.com/59790 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
0e2cde7c69
commit
3bd79713b7
@ -1658,19 +1658,3 @@ func dwarfaddelfsectionsyms(ctxt *Link) {
|
||||
putelfsectionsym(sym, sym.Sect.Elfsect.shnum)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Windows PE
|
||||
*/
|
||||
func dwarfaddpeheaders(ctxt *Link) {
|
||||
if *FlagW { // disable dwarf
|
||||
return
|
||||
}
|
||||
for _, sect := range Segdwarf.Sections {
|
||||
h := pefile.addDWARFSection(sect.Name, int(sect.Length))
|
||||
fileoff := sect.Vaddr - Segdwarf.Vaddr + Segdwarf.Fileoff
|
||||
if uint64(h.PointerToRawData) != fileoff {
|
||||
Exitf("%s.PointerToRawData = %#x, want %#x", sect.Name, h.PointerToRawData, fileoff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +428,23 @@ func (f *peFile) addDWARFSection(name string, size int) *peSection {
|
||||
return h
|
||||
}
|
||||
|
||||
// addDWARF adds DWARF information to the COFF file f.
|
||||
func (f *peFile) addDWARF() {
|
||||
if *FlagS { // disable symbol table
|
||||
return
|
||||
}
|
||||
if *FlagW { // disable dwarf
|
||||
return
|
||||
}
|
||||
for _, sect := range Segdwarf.Sections {
|
||||
h := f.addDWARFSection(sect.Name, int(sect.Length))
|
||||
fileoff := sect.Vaddr - Segdwarf.Vaddr + Segdwarf.Fileoff
|
||||
if uint64(h.PointerToRawData) != fileoff {
|
||||
Exitf("%s.PointerToRawData = %#x, want %#x", sect.Name, h.PointerToRawData, fileoff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// addInitArray adds .ctors COFF section to the file f.
|
||||
func (f *peFile) addInitArray(ctxt *Link) *peSection {
|
||||
// The size below was determined by the specification for array relocations,
|
||||
@ -1307,9 +1324,7 @@ func Asmbpe(ctxt *Link) {
|
||||
pefile.bssSect = b
|
||||
}
|
||||
|
||||
if !*FlagS {
|
||||
dwarfaddpeheaders(ctxt)
|
||||
}
|
||||
pefile.addDWARF()
|
||||
|
||||
if Linkmode == LinkExternal {
|
||||
pefile.ctorsSect = pefile.addInitArray(ctxt)
|
||||
|
Loading…
Reference in New Issue
Block a user