Skip to content

Commit 1152615

Browse files
committed
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>
1 parent 7f57499 commit 1152615

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

api/next/61974.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pkg debug/elf, const R_MIPS_PC32 = 248 #61974
2+
pkg debug/elf, const R_MIPS_PC32 R_MIPS #61974

src/cmd/link/internal/loadelf/ldelf.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,8 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
10181018
MIPS64 | uint32(elf.R_MIPS_CALL16)<<16,
10191019
MIPS64 | uint32(elf.R_MIPS_GPREL32)<<16,
10201020
MIPS64 | uint32(elf.R_MIPS_64)<<16,
1021-
MIPS64 | uint32(elf.R_MIPS_GOT_DISP)<<16:
1021+
MIPS64 | uint32(elf.R_MIPS_GOT_DISP)<<16,
1022+
MIPS64 | uint32(elf.R_MIPS_PC32)<<16:
10221023
return 4, 4, nil
10231024

10241025
case LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_PCREL)<<16,

src/debug/elf/elf.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,8 @@ const (
22162216
R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */
22172217
R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */
22182218
R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */
2219+
2220+
R_MIPS_PC32 R_MIPS = 248 /* 32 bit PC relative reference */
22192221
)
22202222

22212223
var rmipsStrings = []intName{
@@ -2267,6 +2269,7 @@ var rmipsStrings = []intName{
22672269
{48, "R_MIPS_TLS_TPREL64"},
22682270
{49, "R_MIPS_TLS_TPREL_HI16"},
22692271
{50, "R_MIPS_TLS_TPREL_LO16"},
2272+
{248, "R_MIPS_PC32"},
22702273
}
22712274

22722275
func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) }

0 commit comments

Comments
 (0)