]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/internal/goobj: store relocation type as uint16
authorCherry Zhang <cherryyz@google.com>
Sun, 8 Nov 2020 16:27:53 +0000 (11:27 -0500)
committerCherry Zhang <cherryyz@google.com>
Fri, 5 Mar 2021 23:34:43 +0000 (23:34 +0000)
commitf901ea701ddac5a4d600d49007e54caa32b4c9b5
tree30fc1857082153506af456117a382a224302887c
parent87d29939c8f93799ce889d98e0e5579d1eb2ffe5
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>
src/cmd/internal/goobj/objfile.go
src/cmd/internal/goobj/objfile_test.go
src/cmd/internal/obj/objfile.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loader/loader_test.go
src/cmd/link/internal/loader/symbolbuilder.go