mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: separate out DWARF processing from dodata's allocateSections
Split out DWARF symbol-to-section assignment into its own separate helper routine, to improve readability. No change in functionality. Change-Id: Ic2e4f4d99afbff65161cbb8bd63e866ea555f322 Reviewed-on: https://go-review.googlesource.com/c/go/+/228957 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
87b43088cd
commit
7a22f11e96
1 changed files with 15 additions and 4 deletions
|
|
@ -1480,7 +1480,13 @@ func (ctxt *Link) dodata() {
|
||||||
ctxt.Syms.ROLookup("runtime.bss", 0).Align = state.dataMaxAlign[sym.SBSS]
|
ctxt.Syms.ROLookup("runtime.bss", 0).Align = state.dataMaxAlign[sym.SBSS]
|
||||||
}
|
}
|
||||||
|
|
||||||
state.allocateSections(ctxt)
|
// Create *sym.Section objects and assign symbols to sections for
|
||||||
|
// data/rodata (and related) symbols.
|
||||||
|
state.allocateDataSections(ctxt)
|
||||||
|
|
||||||
|
// Create *sym.Section objects and assign symbols to sections for
|
||||||
|
// DWARF symbols.
|
||||||
|
state.allocateDwarfSections(ctxt)
|
||||||
|
|
||||||
/* number the sections */
|
/* number the sections */
|
||||||
n := int16(1)
|
n := int16(1)
|
||||||
|
|
@ -1599,9 +1605,9 @@ func (state *dodataState) allocateNamedSectionAndAssignSyms(seg *sym.Segment, se
|
||||||
return sect
|
return sect
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocateSections allocates sym.Section objects for data sections
|
// allocateDataSections allocates sym.Section objects for data/rodata
|
||||||
// of interest and assigns symbols into the sections.
|
// (and related) symbols, and then assigns symbols to those sections.
|
||||||
func (state *dodataState) allocateSections(ctxt *Link) {
|
func (state *dodataState) allocateDataSections(ctxt *Link) {
|
||||||
// Allocate sections.
|
// Allocate sections.
|
||||||
// Data is processed before segtext, because we need
|
// Data is processed before segtext, because we need
|
||||||
// to see all symbols in the .data and .bss sections in order
|
// to see all symbols in the .data and .bss sections in order
|
||||||
|
|
@ -1899,6 +1905,11 @@ func (state *dodataState) allocateSections(ctxt *Link) {
|
||||||
for symn := sym.SELFRXSECT; symn < sym.SXREF; symn++ {
|
for symn := sym.SELFRXSECT; symn < sym.SXREF; symn++ {
|
||||||
ctxt.datap = append(ctxt.datap, state.data[symn]...)
|
ctxt.datap = append(ctxt.datap, state.data[symn]...)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocateDwarfSections allocates sym.Section objects for DWARF
|
||||||
|
// symbols, and assigns symbols to sections.
|
||||||
|
func (state *dodataState) allocateDwarfSections(ctxt *Link) {
|
||||||
|
|
||||||
alignOne := func(datsize int64, s *sym.Symbol) int64 { return datsize }
|
alignOne := func(datsize int64, s *sym.Symbol) int64 { return datsize }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue