mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/goobj: store relocation type as uint16
Currently, relocation type is stored as uint8 in object files, as
Go relocations do not exceed 255. In the linker, however, it is
used as a 16-bit type, because external relocations can exceed
255. The linker has to store the extra byte in a side table. This
complicates many things.
Just store it as uint16 in object files. This simplifies things,
with a small cost of increasing the object file sizes.
before after
hello.o 1672 1678
runtime.a 7927784 8056194
Change-Id: I313cf44ad0b8b3b76e35055ae55d911ff35e3158
Reviewed-on: https://go-review.googlesource.com/c/go/+/268477
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
87d29939c8
commit
f901ea701d
6 changed files with 40 additions and 64 deletions
|
|
@ -498,7 +498,7 @@ func (w *writer) Reloc(r *Reloc) {
|
|||
var o goobj.Reloc
|
||||
o.SetOff(r.Off)
|
||||
o.SetSiz(r.Siz)
|
||||
o.SetType(uint8(r.Type))
|
||||
o.SetType(uint16(r.Type))
|
||||
o.SetAdd(r.Add)
|
||||
o.SetSym(makeSymRef(r.Sym))
|
||||
o.Write(w.Writer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue