1
0
mirror of https://github.com/golang/go synced 2024-11-26 01:17:57 -07:00

cmd/link/internal/loadelf: support additional ELF relocations on mips64

LLVM on openbsd/mips64 generates R_MIPS_GOT_HI16 and R_MIPS_GOT_LO16 relocations,
so teach cmd/link/internal/loadelf about both of these.

Updates #43005

Change-Id: Ic45ea8b901d44dcbdbf355411ee434dcd7670a92
Reviewed-on: https://go-review.googlesource.com/c/go/+/275894
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Joel Sing 2020-12-08 04:23:36 +11:00
parent 58e381b0b2
commit e508c1c67b

View File

@ -969,6 +969,8 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, error) {
case MIPS | uint32(elf.R_MIPS_HI16)<<16,
MIPS | uint32(elf.R_MIPS_LO16)<<16,
MIPS | uint32(elf.R_MIPS_GOT16)<<16,
MIPS | uint32(elf.R_MIPS_GOT_HI16)<<16,
MIPS | uint32(elf.R_MIPS_GOT_LO16)<<16,
MIPS | uint32(elf.R_MIPS_GPREL16)<<16,
MIPS | uint32(elf.R_MIPS_GOT_PAGE)<<16,
MIPS | uint32(elf.R_MIPS_JALR)<<16,
@ -976,6 +978,8 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, error) {
MIPS64 | uint32(elf.R_MIPS_HI16)<<16,
MIPS64 | uint32(elf.R_MIPS_LO16)<<16,
MIPS64 | uint32(elf.R_MIPS_GOT16)<<16,
MIPS64 | uint32(elf.R_MIPS_GOT_HI16)<<16,
MIPS64 | uint32(elf.R_MIPS_GOT_LO16)<<16,
MIPS64 | uint32(elf.R_MIPS_GPREL16)<<16,
MIPS64 | uint32(elf.R_MIPS_GOT_PAGE)<<16,
MIPS64 | uint32(elf.R_MIPS_JALR)<<16,