diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-04-06 15:58:21 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-04-08 15:32:39 +0000 |
commit | 850c602ed62fb36430b872f31ac86142d8eaa5f3 (patch) | |
tree | 545ef2ce9635dc20b1f00360d6a529c5600ccf76 /src/cmd/link/internal/ld/lib.go | |
parent | 5072c166a11f053a63c501c527e267a20b5176e1 (diff) | |
download | go-850c602ed62fb36430b872f31ac86142d8eaa5f3.tar.gz go-850c602ed62fb36430b872f31ac86142d8eaa5f3.zip |
[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>
Diffstat (limited to 'src/cmd/link/internal/ld/lib.go')
-rw-r--r-- | src/cmd/link/internal/ld/lib.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index f16de043ef..e560fea2f1 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -254,7 +254,10 @@ type Arch struct { // offset value. Archrelocvariant func(target *Target, syms *ArchSyms, rel *sym.Reloc, sym *sym.Symbol, offset int64) (relocatedOffset int64) - Trampoline func(*Link, *sym.Reloc, *sym.Symbol) + + // Generate a trampoline for a call from s to rs if necessary. ri is + // index of the relocation. + Trampoline func(ctxt *Link, ldr *loader.Loader, ri int, rs, s loader.Sym) // Asmb and Asmb2 are arch-specific routines that write the output // file. Typically, Asmb writes most of the content (sections and @@ -280,7 +283,7 @@ type Arch struct { TLSIEtoLE func(s *sym.Symbol, off, size int) // optional override for assignAddress - AssignAddress func(ctxt *Link, sect *sym.Section, n int, s *sym.Symbol, va uint64, isTramp bool) (*sym.Section, int, uint64) + AssignAddress func(ldr *loader.Loader, sect *sym.Section, n int, s loader.Sym, va uint64, isTramp bool) (*sym.Section, int, uint64) } var ( |