1
0
mirror of https://github.com/golang/go synced 2024-11-19 16:54:44 -07:00

cmd/link: implement R_X86_64_PC64 relocations

Change-Id: I1d7bd5cff7350a4e0f78b8efc8406e79c74732d1
Reviewed-on: https://go-review.googlesource.com/55370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2017-08-11 16:22:10 -04:00
parent 9223adcc2c
commit ef6978b218
2 changed files with 12 additions and 0 deletions

View File

@ -118,6 +118,17 @@ func adddynrel(ctxt *ld.Link, s *ld.Symbol, r *ld.Reloc) bool {
r.Add += 4 r.Add += 4
return true return true
case 256 + ld.R_X86_64_PC64:
if targ.Type == ld.SDYNIMPORT {
ld.Errorf(s, "unexpected R_X86_64_PC64 relocation for dynamic symbol %s", targ.Name)
}
if targ.Type == 0 || targ.Type == ld.SXREF {
ld.Errorf(s, "unknown symbol %s in pcrel", targ.Name)
}
r.Type = objabi.R_PCREL
r.Add += 8
return true
case 256 + ld.R_X86_64_PLT32: case 256 + ld.R_X86_64_PLT32:
r.Type = objabi.R_PCREL r.Type = objabi.R_PCREL
r.Add += 4 r.Add += 4

View File

@ -1210,6 +1210,7 @@ func relSize(ctxt *Link, pn string, elftype uint32) uint8 {
return 4 return 4
case AMD64 | R_X86_64_64<<24, case AMD64 | R_X86_64_64<<24,
AMD64 | R_X86_64_PC64<<24,
PPC64 | R_PPC64_ADDR64<<24, PPC64 | R_PPC64_ADDR64<<24,
S390X | R_390_GLOB_DAT<<24, S390X | R_390_GLOB_DAT<<24,
S390X | R_390_RELATIVE<<24, S390X | R_390_RELATIVE<<24,