mirror of
https://github.com/golang/go
synced 2024-10-02 08:18:32 -06:00
cmd/link: delete shNames
Change-Id: Ie5d12ba4105fec17551637d066d0dffd508f74a4 Reviewed-on: https://go-review.googlesource.com/55261 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
6aa386686c
commit
a9257b6b69
@ -340,9 +340,6 @@ var oh IMAGE_OPTIONAL_HEADER
|
|||||||
|
|
||||||
var oh64 PE64_IMAGE_OPTIONAL_HEADER
|
var oh64 PE64_IMAGE_OPTIONAL_HEADER
|
||||||
|
|
||||||
// shNames stores full names of PE sections stored in sh.
|
|
||||||
var shNames []string
|
|
||||||
|
|
||||||
var dd []IMAGE_DATA_DIRECTORY
|
var dd []IMAGE_DATA_DIRECTORY
|
||||||
|
|
||||||
type Imp struct {
|
type Imp struct {
|
||||||
@ -450,7 +447,6 @@ func (f *peFile) addSection(name string, sectsize int, filesize int) *peSection
|
|||||||
}
|
}
|
||||||
f.sections = append(f.sections, sect)
|
f.sections = append(f.sections, sect)
|
||||||
pensect++
|
pensect++
|
||||||
shNames = append(shNames, name)
|
|
||||||
return sect
|
return sect
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -951,9 +947,9 @@ func peemitreloc(ctxt *Link, text, data, ctors *peSection) {
|
|||||||
|
|
||||||
dwarfLoop:
|
dwarfLoop:
|
||||||
for _, sect := range Segdwarf.Sections {
|
for _, sect := range Segdwarf.Sections {
|
||||||
for i, name := range shNames {
|
for _, pesect := range pefile.sections {
|
||||||
if sect.Name == name {
|
if sect.Name == pesect.name {
|
||||||
peemitsectreloc(pefile.sections[i], func() int {
|
peemitsectreloc(pesect, func() int {
|
||||||
return perelocsect(ctxt, sect, dwarfp, sect.Vaddr)
|
return perelocsect(ctxt, sect, dwarfp, sect.Vaddr)
|
||||||
})
|
})
|
||||||
continue dwarfLoop
|
continue dwarfLoop
|
||||||
@ -1090,9 +1086,9 @@ func writePESymTableRecords(ctxt *Link) int {
|
|||||||
if Linkmode == LinkExternal {
|
if Linkmode == LinkExternal {
|
||||||
// Include section symbols as external, because
|
// Include section symbols as external, because
|
||||||
// .ctors and .debug_* section relocations refer to it.
|
// .ctors and .debug_* section relocations refer to it.
|
||||||
for idx, name := range shNames {
|
for _, pesect := range pefile.sections {
|
||||||
sym := ctxt.Syms.Lookup(name, 0)
|
sym := ctxt.Syms.Lookup(pesect.name, 0)
|
||||||
writeOneSymbol(sym, 0, idx+1, IMAGE_SYM_TYPE_NULL, IMAGE_SYM_CLASS_STATIC)
|
writeOneSymbol(sym, 0, pesect.index, IMAGE_SYM_TYPE_NULL, IMAGE_SYM_CLASS_STATIC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user