[dev.link] cmd/link: convert text address assignment to new style

Implement text address assignment and trampoline generation using
the loader.

Note: the trampoline insertion part doesn't actually work. It
also needs to propagate Aux symbols for external symbols in
LoadFull.  But it won't be needed after converting pclntab
generation, so I'll leave it out for now. This could break
linking large binaries on PPC64 and ARM.

Change-Id: Ie46a35b25d7c027983dd877207cfa8f67c32530b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227482
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2020-04-06 15:58:21 -04:00
parent 5072c166a1
commit 850c602ed6
9 changed files with 269 additions and 194 deletions

View file

@ -88,6 +88,7 @@ func (sb *SymbolBuilder) Dynimpvers() string { return sb.l.SymDynimpvers(sb.
func (sb *SymbolBuilder) SubSym() Sym { return sb.l.SubSym(sb.symIdx) }
func (sb *SymbolBuilder) GoType() Sym { return sb.l.SymGoType(sb.symIdx) }
func (sb *SymbolBuilder) VisibilityHidden() bool { return sb.l.AttrVisibilityHidden(sb.symIdx) }
func (sb *SymbolBuilder) Sect() *sym.Section { return sb.l.SymSect(sb.symIdx) }
// Setters for symbol properties.
@ -108,10 +109,10 @@ func (sb *SymbolBuilder) SetSpecial(value bool) { sb.l.SetAttrSpecial(sb.sy
func (sb *SymbolBuilder) SetVisibilityHidden(value bool) {
sb.l.SetAttrVisibilityHidden(sb.symIdx, value)
}
func (sb *SymbolBuilder) SetNotInSymbolTable(value bool) {
sb.l.SetAttrNotInSymbolTable(sb.symIdx, value)
}
func (sb *SymbolBuilder) SetSect(sect *sym.Section) { sb.l.SetSymSect(sb.symIdx, sect) }
func (sb *SymbolBuilder) AddBytes(data []byte) {
sb.setReachable()