diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-04-29 23:53:33 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-04-30 15:53:32 +0000 |
commit | 5aa59c6a99606d914abb170ee3e15342af3727b8 (patch) | |
tree | 9bf0f7d34d2826b53c3894ea23932b96e3af9679 /src/cmd/link/internal/ld/lib.go | |
parent | d23cd597aac567a048f4d87a7d6d993bf59ddffd (diff) | |
download | go-5aa59c6a99606d914abb170ee3e15342af3727b8.tar.gz go-5aa59c6a99606d914abb170ee3e15342af3727b8.zip |
[dev.link] cmd/link: unescape relocs passed to Archreloc2
Archreloc2 is a function pointer. It will escape its pointer
arguments. In relocsym, as we pass &r and &rr to Archreloc2, it
causes them to escape, even if Archreloc2 is not actually called.
Instead, pass r by value. loader.Reloc2 is a small structure
which is intended to be passed by value.
For rr, as Archreloc2 will likely return true, we speculatively
add it to extRelocs slice and use that space to pass to
Archreloc2.
Linking cmd/compile,
name old alloc/op new alloc/op delta
Dwarfcompress_GC 110MB ± 0% 24MB ± 0% -78.34% (p=0.008 n=5+5)
Reloc_GC 24.6MB ± 0% 0.0MB ± 0% -100.00% (p=0.029 n=4+4)
Linking cmd/compile using external linking
name old alloc/op new alloc/op delta
Reloc_GC 152MB ± 0% 36MB ± 0% -76.07% (p=0.008 n=5+5)
Change-Id: I1415479e0c17ea9787f9a62453dce00ad9ea792f
Reviewed-on: https://go-review.googlesource.com/c/go/+/231077
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/lib.go')
-rw-r--r-- | src/cmd/link/internal/ld/lib.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 3b76f3a236..9a87cbef33 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -246,7 +246,7 @@ type Arch struct { // indicates a fatal error). Archreloc func(target *Target, syms *ArchSyms, rel *sym.Reloc, sym *sym.Symbol, offset int64) (relocatedOffset int64, success bool) - Archreloc2 func(*Target, *loader.Loader, *ArchSyms, *loader.Reloc2, *loader.ExtReloc, loader.Sym, int64) (int64, bool, bool) + Archreloc2 func(*Target, *loader.Loader, *ArchSyms, loader.Reloc2, *loader.ExtReloc, loader.Sym, int64) (int64, bool, bool) // Archrelocvariant is a second arch-specific hook used for // relocation processing; it handles relocations where r.Type is // insufficient to describe the relocation (r.Variant != |