1
0
mirror of https://github.com/golang/go synced 2024-11-11 19:51:37 -07:00

debug/elf,cmd/link: add additional MIPS64 relocation type

Add R_MIPS_PC32 which is a 32 bit PC relative relocation.

These are produced by LLVM on mips64.

Fixes #61974

Change-Id: I7b6c6848e40249e6d5ea474ea53c9d7e3ab23f88
Reviewed-on: https://go-review.googlesource.com/c/go/+/469395
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Joel Sing 2023-02-18 16:41:25 +11:00
parent 7f57499853
commit 1152615d20
3 changed files with 7 additions and 1 deletions

2
api/next/61974.txt Normal file
View File

@ -0,0 +1,2 @@
pkg debug/elf, const R_MIPS_PC32 = 248 #61974
pkg debug/elf, const R_MIPS_PC32 R_MIPS #61974

View File

@ -1018,7 +1018,8 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
MIPS64 | uint32(elf.R_MIPS_CALL16)<<16, MIPS64 | uint32(elf.R_MIPS_CALL16)<<16,
MIPS64 | uint32(elf.R_MIPS_GPREL32)<<16, MIPS64 | uint32(elf.R_MIPS_GPREL32)<<16,
MIPS64 | uint32(elf.R_MIPS_64)<<16, MIPS64 | uint32(elf.R_MIPS_64)<<16,
MIPS64 | uint32(elf.R_MIPS_GOT_DISP)<<16: MIPS64 | uint32(elf.R_MIPS_GOT_DISP)<<16,
MIPS64 | uint32(elf.R_MIPS_PC32)<<16:
return 4, 4, nil return 4, 4, nil
case LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_PCREL)<<16, case LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_PCREL)<<16,

View File

@ -2216,6 +2216,8 @@ const (
R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */ R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */
R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */ R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */
R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */ R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */
R_MIPS_PC32 R_MIPS = 248 /* 32 bit PC relative reference */
) )
var rmipsStrings = []intName{ var rmipsStrings = []intName{
@ -2267,6 +2269,7 @@ var rmipsStrings = []intName{
{48, "R_MIPS_TLS_TPREL64"}, {48, "R_MIPS_TLS_TPREL64"},
{49, "R_MIPS_TLS_TPREL_HI16"}, {49, "R_MIPS_TLS_TPREL_HI16"},
{50, "R_MIPS_TLS_TPREL_LO16"}, {50, "R_MIPS_TLS_TPREL_LO16"},
{248, "R_MIPS_PC32"},
} }
func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) } func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) }