diff --git a/src/cmd/link/internal/amd64/asm.go b/src/cmd/link/internal/amd64/asm.go index 1e50802bb3..fa785c25f3 100644 --- a/src/cmd/link/internal/amd64/asm.go +++ b/src/cmd/link/internal/amd64/asm.go @@ -139,7 +139,7 @@ func adddynrel(s *ld.LSym, r *ld.Reloc) { return - case 256 + ld.R_X86_64_GOTPCREL: + case 256 + ld.R_X86_64_GOTPCREL, 256 + ld.R_X86_64_GOTPCRELX, 256 + ld.R_X86_64_REX_GOTPCRELX: if targ.Type != obj.SDYNIMPORT { // have symbol if r.Off >= 2 && s.P[r.Off-2] == 0x8b { diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go index 2cce02287d..80d586145e 100644 --- a/src/cmd/link/internal/ld/elf.go +++ b/src/cmd/link/internal/ld/elf.go @@ -325,31 +325,47 @@ const ( * Relocation types. */ const ( - R_X86_64_NONE = 0 - R_X86_64_64 = 1 - R_X86_64_PC32 = 2 - R_X86_64_GOT32 = 3 - R_X86_64_PLT32 = 4 - R_X86_64_COPY = 5 - R_X86_64_GLOB_DAT = 6 - R_X86_64_JMP_SLOT = 7 - R_X86_64_RELATIVE = 8 - R_X86_64_GOTPCREL = 9 - R_X86_64_32 = 10 - R_X86_64_32S = 11 - R_X86_64_16 = 12 - R_X86_64_PC16 = 13 - R_X86_64_8 = 14 - R_X86_64_PC8 = 15 - R_X86_64_DTPMOD64 = 16 - R_X86_64_DTPOFF64 = 17 - R_X86_64_TPOFF64 = 18 - R_X86_64_TLSGD = 19 - R_X86_64_TLSLD = 20 - R_X86_64_DTPOFF32 = 21 - R_X86_64_GOTTPOFF = 22 - R_X86_64_TPOFF32 = 23 - R_X86_64_COUNT = 24 + R_X86_64_NONE = 0 + R_X86_64_64 = 1 + R_X86_64_PC32 = 2 + R_X86_64_GOT32 = 3 + R_X86_64_PLT32 = 4 + R_X86_64_COPY = 5 + R_X86_64_GLOB_DAT = 6 + R_X86_64_JMP_SLOT = 7 + R_X86_64_RELATIVE = 8 + R_X86_64_GOTPCREL = 9 + R_X86_64_32 = 10 + R_X86_64_32S = 11 + R_X86_64_16 = 12 + R_X86_64_PC16 = 13 + R_X86_64_8 = 14 + R_X86_64_PC8 = 15 + R_X86_64_DTPMOD64 = 16 + R_X86_64_DTPOFF64 = 17 + R_X86_64_TPOFF64 = 18 + R_X86_64_TLSGD = 19 + R_X86_64_TLSLD = 20 + R_X86_64_DTPOFF32 = 21 + R_X86_64_GOTTPOFF = 22 + R_X86_64_TPOFF32 = 23 + R_X86_64_PC64 = 24 + R_X86_64_GOTOFF64 = 25 + R_X86_64_GOTPC32 = 26 + R_X86_64_GOT64 = 27 + R_X86_64_GOTPCREL64 = 28 + R_X86_64_GOTPC64 = 29 + R_X86_64_GOTPLT64 = 30 + R_X86_64_PLTOFF64 = 31 + R_X86_64_SIZE32 = 32 + R_X86_64_SIZE64 = 33 + R_X86_64_GOTPC32_TLSDEC = 34 + R_X86_64_TLSDESC_CALL = 35 + R_X86_64_TLSDESC = 36 + R_X86_64_IRELATIVE = 37 + R_X86_64_PC32_BND = 40 + R_X86_64_GOTPCRELX = 41 + R_X86_64_REX_GOTPCRELX = 42 R_AARCH64_ABS64 = 257 R_AARCH64_ABS32 = 258 @@ -388,7 +404,6 @@ const ( R_ALPHA_GLOB_DAT = 25 R_ALPHA_JMP_SLOT = 26 R_ALPHA_RELATIVE = 27 - R_ALPHA_COUNT = 28 R_ARM_NONE = 0 R_ARM_PC24 = 1 @@ -429,40 +444,43 @@ const ( R_ARM_RABS32 = 253 R_ARM_RPC24 = 254 R_ARM_RBASE = 255 - R_ARM_COUNT = 38 - R_386_NONE = 0 - R_386_32 = 1 - R_386_PC32 = 2 - R_386_GOT32 = 3 - R_386_PLT32 = 4 - R_386_COPY = 5 - R_386_GLOB_DAT = 6 - R_386_JMP_SLOT = 7 - R_386_RELATIVE = 8 - R_386_GOTOFF = 9 - R_386_GOTPC = 10 - R_386_TLS_TPOFF = 14 - R_386_TLS_IE = 15 - R_386_TLS_GOTIE = 16 - R_386_TLS_LE = 17 - R_386_TLS_GD = 18 - R_386_TLS_LDM = 19 - R_386_TLS_GD_32 = 24 - R_386_TLS_GD_PUSH = 25 - R_386_TLS_GD_CALL = 26 - R_386_TLS_GD_POP = 27 - R_386_TLS_LDM_32 = 28 - R_386_TLS_LDM_PUSH = 29 - R_386_TLS_LDM_CALL = 30 - R_386_TLS_LDM_POP = 31 - R_386_TLS_LDO_32 = 32 - R_386_TLS_IE_32 = 33 - R_386_TLS_LE_32 = 34 - R_386_TLS_DTPMOD32 = 35 - R_386_TLS_DTPOFF32 = 36 - R_386_TLS_TPOFF32 = 37 - R_386_COUNT = 38 + R_386_NONE = 0 + R_386_32 = 1 + R_386_PC32 = 2 + R_386_GOT32 = 3 + R_386_PLT32 = 4 + R_386_COPY = 5 + R_386_GLOB_DAT = 6 + R_386_JMP_SLOT = 7 + R_386_RELATIVE = 8 + R_386_GOTOFF = 9 + R_386_GOTPC = 10 + R_386_TLS_TPOFF = 14 + R_386_TLS_IE = 15 + R_386_TLS_GOTIE = 16 + R_386_TLS_LE = 17 + R_386_TLS_GD = 18 + R_386_TLS_LDM = 19 + R_386_TLS_GD_32 = 24 + R_386_TLS_GD_PUSH = 25 + R_386_TLS_GD_CALL = 26 + R_386_TLS_GD_POP = 27 + R_386_TLS_LDM_32 = 28 + R_386_TLS_LDM_PUSH = 29 + R_386_TLS_LDM_CALL = 30 + R_386_TLS_LDM_POP = 31 + R_386_TLS_LDO_32 = 32 + R_386_TLS_IE_32 = 33 + R_386_TLS_LE_32 = 34 + R_386_TLS_DTPMOD32 = 35 + R_386_TLS_DTPOFF32 = 36 + R_386_TLS_TPOFF32 = 37 + R_386_TLS_GOTDESC = 39 + R_386_TLS_DESC_CALL = 40 + R_386_TLS_DESC = 41 + R_386_IRELATIVE = 42 + R_386_GOT32X = 43 R_PPC_NONE = 0 R_PPC_ADDR32 = 1 @@ -501,7 +519,6 @@ const ( R_PPC_SECTOFF_LO = 34 R_PPC_SECTOFF_HI = 35 R_PPC_SECTOFF_HA = 36 - R_PPC_COUNT = 37 R_PPC_TLS = 67 R_PPC_DTPMOD32 = 68 R_PPC_TPREL16 = 69 @@ -542,7 +559,6 @@ const ( R_PPC_EMB_RELST_HA = 114 R_PPC_EMB_BIT_FLD = 115 R_PPC_EMB_RELSDA = 116 - R_PPC_EMB_COUNT = R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1 R_PPC64_REL24 = R_PPC_REL24 R_PPC64_JMP_SLOT = R_PPC_JMP_SLOT diff --git a/src/cmd/link/internal/ld/ldelf.go b/src/cmd/link/internal/ld/ldelf.go index 20e23117ad..a321016999 100644 --- a/src/cmd/link/internal/ld/ldelf.go +++ b/src/cmd/link/internal/ld/ldelf.go @@ -1137,12 +1137,15 @@ func reltype(pn string, elftype int, siz *uint8) int { '6' | R_X86_64_PC32<<24, '6' | R_X86_64_PLT32<<24, '6' | R_X86_64_GOTPCREL<<24, + '6' | R_X86_64_GOTPCRELX<<24, + '6' | R_X86_64_REX_GOTPCRELX<<24, '8' | R_386_32<<24, '8' | R_386_PC32<<24, '8' | R_386_GOT32<<24, '8' | R_386_PLT32<<24, '8' | R_386_GOTOFF<<24, '8' | R_386_GOTPC<<24, + '8' | R_386_GOT32X<<24, '9' | R_PPC64_REL24<<24: *siz = 4 diff --git a/src/cmd/link/internal/x86/asm.go b/src/cmd/link/internal/x86/asm.go index 8f9507168c..7f619b5c34 100644 --- a/src/cmd/link/internal/x86/asm.go +++ b/src/cmd/link/internal/x86/asm.go @@ -78,7 +78,7 @@ func adddynrel(s *ld.LSym, r *ld.Reloc) { return - case 256 + ld.R_386_GOT32: + case 256 + ld.R_386_GOT32, 256 + ld.R_386_GOT32X: if targ.Type != obj.SDYNIMPORT { // have symbol if r.Off >= 2 && s.P[r.Off-2] == 0x8b {