]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/loadelf: support additional ELF relocations on mips64
authorJoel Sing <joel@sing.id.au>
Mon, 7 Dec 2020 17:23:36 +0000 (04:23 +1100)
committerJoel Sing <joel@sing.id.au>
Fri, 11 Dec 2020 08:18:17 +0000 (08:18 +0000)
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>
src/cmd/link/internal/loadelf/ldelf.go

index db543a5e50c359890cbd1466a9cde518a5150652..c698874b3255ffd3a0e9ca9baa021373ca6905f6 100644 (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,