[dev.link] cmd/link: stream external relocations on ARM64 and on Darwin

Support streaming external relocations on ARM64. Support
architecture-specific relocations.

Also support streaming external relocations on Darwin. Do it in
the same CL so ARM64's archreloc doesn't need to support both
streaming and non-streaming.

Change-Id: Ia7fee9957892f98c065022c69a51f47402f4d6e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/243644
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Cherry Zhang 2020-07-17 17:56:17 -04:00
parent 936a2d6966
commit bf1816c7b7
6 changed files with 72 additions and 23 deletions

View file

@ -239,6 +239,11 @@ type Arch struct {
Asmb func(*Link, *loader.Loader)
Asmb2 func(*Link, *loader.Loader)
// Extreloc is an arch-specific hook that converts a Go relocation to an
// external relocation. Return the external relocation and whether it is
// needed.
Extreloc func(*Target, *loader.Loader, loader.Reloc2, loader.Sym) (loader.ExtReloc, bool)
Elfreloc1 func(*Link, *OutBuf, *loader.Loader, loader.Sym, loader.ExtRelocView, int64) bool
ElfrelocSize uint32 // size of an ELF relocation record, must match Elfreloc1.
Elfsetupplt func(ctxt *Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym)