cmd/link: increase the reserved space for ELF relocations

Currently the offset values of ELF relocations and Macho relocations
are 256 and 512 respectively, which means that the space reserved for
ELF relocations is only 256. But AARCH64 has more than 256 ELF relocation
types, in fact the maximum AARCH64 ELF relocation type recorded in file
src/debug/elf/elf.go is 1032 currently. So this CL increases the offset
of Macho relocations to 2048 to leave enough space for AARCH64 ELF
relocations.

Change-Id: I784ac38aeb3e102ac7825f6d621086849c8d3146
Reviewed-on: https://go-review.googlesource.com/c/go/+/172497
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
erifan01 2019-04-16 02:49:09 +00:00 committed by Ian Lance Taylor
parent b5946ed48d
commit 3b37ff453e
11 changed files with 109 additions and 101 deletions

View file

@ -34,6 +34,11 @@ var (
Version = version
)
const (
ElfRelocOffset = 256
MachoRelocOffset = 2048 // reserve enough space for ELF relocations
)
func goarm() int {
switch v := envOr("GOARM", defaultGOARM); v {
case "5":