diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-07-28 21:35:53 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-07-30 16:36:25 +0000 |
| commit | 317c1ca9f2bc8b52807171020eb47e988699cf6a (patch) | |
| tree | f4a1bcea4998bc0be4d70440a09313dfb61d970b /src/cmd/link/internal/loader | |
| parent | 880f43c87f1ed20dbd021fc7cbd946b3f3a5b6e5 (diff) | |
| download | go-317c1ca9f2bc8b52807171020eb47e988699cf6a.tar.xz | |
[dev.link] cmd/link: refactor ExtReloc data structures
We used to generate all external relocations in memory, then emit
the relocation records at a later pass. The data structures were
chosen so that it takes as little memory as possible. Now we just
stream out external relocations, and ExtReloc is just a local
variable. Change the data structure to avoid repeated read of
some fields. Also get rid of ExtRelocView, as it is no longer
necessary.
Change-Id: I40209bbe4387af231b29788125c3b4ebb0ff4a33
Reviewed-on: https://go-review.googlesource.com/c/go/+/245479
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loader')
| -rw-r--r-- | src/cmd/link/internal/loader/loader.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go index 2ecde037a3..a2a09c828e 100644 --- a/src/cmd/link/internal/loader/loader.go +++ b/src/cmd/link/internal/loader/loader.go @@ -50,17 +50,10 @@ type Reloc struct { // ExtReloc contains the payload for an external relocation. type ExtReloc struct { - Idx int // index of the original relocation Xsym Sym Xadd int64 -} - -// ExtRelocView is a view of an external relocation. -// It is intended to be constructed on the fly, such as ExtRelocs.At. -// It is not the data structure used to store the payload internally. -type ExtRelocView struct { - Reloc2 - ExtReloc + Type objabi.RelocType + Size uint8 } // Reloc2 holds a "handle" to access a relocation record from an |
