mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[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>
This commit is contained in:
parent
880f43c87f
commit
317c1ca9f2
16 changed files with 81 additions and 83 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue