]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: support R_PPC_REL32 relocation
authorIan Lance Taylor <iant@golang.org>
Mon, 23 Nov 2015 20:55:37 +0000 (12:55 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 24 Nov 2015 00:02:06 +0000 (00:02 +0000)
This relocation is found in libgcc.a in the .eh_frame, and therefore
needs to be handled when doing an internal link.

Fixes #13375.

Change-Id: Idd9e8178e08851a101b43261a30939bcfaf394f9
Reviewed-on: https://go-review.googlesource.com/17173
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
src/cmd/link/internal/ld/ldelf.go
src/cmd/link/internal/ppc64/asm.go

index 66bf61321d85e287246ca1e87548753446b4ff30..bea3f2dcc3bbaf0b8b9845b265faf8bc433f3aaa 100644 (file)
@@ -1159,7 +1159,8 @@ func reltype(pn string, elftype int, siz *uint8) int {
                '8' | R_386_GOTOFF<<24,
                '8' | R_386_GOTPC<<24,
                '8' | R_386_GOT32X<<24,
-               '9' | R_PPC64_REL24<<24:
+               '9' | R_PPC64_REL24<<24,
+               '9' | R_PPC_REL32<<24:
                *siz = 4
 
        case '6' | R_X86_64_64<<24,
index 06e412431ebb91235ee4665ba30c49fc2e088a5a..169accc594ab0495c42af544e914d42211bb17a2 100644 (file)
@@ -296,6 +296,16 @@ func adddynrel(s *ld.LSym, r *ld.Reloc) {
 
                return
 
+       case 256 + ld.R_PPC_REL32:
+               r.Type = obj.R_PCREL
+               r.Add += 4
+
+               if targ.Type == obj.SDYNIMPORT {
+                       ld.Diag("unexpected R_PPC_REL32 for dyn import")
+               }
+
+               return
+
        case 256 + ld.R_PPC64_ADDR64:
                r.Type = obj.R_ADDR
                if targ.Type == obj.SDYNIMPORT {