diff options
author | Joel Sing <joel@sing.id.au> | 2020-12-08 04:23:36 +1100 |
---|---|---|
committer | Joel Sing <joel@sing.id.au> | 2020-12-11 08:18:17 +0000 |
commit | e508c1c67b02dceea146ce3472c0f8ce9e60632c (patch) | |
tree | 91e171da7b6e4b71ccb5640eae3c75a09677466c | |
parent | 58e381b0b22352dda355f6d95fa101b773766c72 (diff) | |
download | go-e508c1c67b02dceea146ce3472c0f8ce9e60632c.tar.gz go-e508c1c67b02dceea146ce3472c0f8ce9e60632c.zip |
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>
-rw-r--r-- | src/cmd/link/internal/loadelf/ldelf.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go index db543a5e50..c698874b32 100644 --- a/src/cmd/link/internal/loadelf/ldelf.go +++ b/src/cmd/link/internal/loadelf/ldelf.go @@ -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, |