]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: remove elderly ld bug workaround on arm64
authorThan McIntosh <thanm@google.com>
Mon, 4 May 2020 18:24:03 +0000 (14:24 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 5 May 2020 16:23:24 +0000 (16:23 +0000)
The arm64 archreloc method contains a workaround for a 2015-era
binutils/linker bug, https://sourceware.org/bugzilla/show_bug.cgi?id=18270.
This bug has been fixed for some time now, so remove the workaround
for it (the workaround includes some code that mutates a relocation
type, which is something we want to void doing in the new linker).

Change-Id: I9b7584e4daad240bbb85de673d704731705c8148
Reviewed-on: https://go-review.googlesource.com/c/go/+/232200
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/arm64/asm.go

index 7fedb04bc8f2be72e5eef1835fe784ed75db0e7e..0d2687869936a068663fd4cf79e7b72631b76622 100644 (file)
@@ -445,37 +445,8 @@ func archreloc(target *ld.Target, syms *ld.ArchSyms, r *sym.Reloc, s *sym.Symbol
                switch r.Type {
                default:
                        return val, false
-               case objabi.R_ARM64_GOTPCREL:
-                       var o1, o2 uint32
-                       if target.IsBigEndian() {
-                               o1 = uint32(val >> 32)
-                               o2 = uint32(val)
-                       } else {
-                               o1 = uint32(val)
-                               o2 = uint32(val >> 32)
-                       }
-                       // Any relocation against a function symbol is redirected to
-                       // be against a local symbol instead (see putelfsym in
-                       // symtab.go) but unfortunately the system linker was buggy
-                       // when confronted with a R_AARCH64_ADR_GOT_PAGE relocation
-                       // against a local symbol until May 2015
-                       // (https://sourceware.org/bugzilla/show_bug.cgi?id=18270). So
-                       // we convert the adrp; ld64 + R_ARM64_GOTPCREL into adrp;
-                       // add + R_ADDRARM64.
-                       if !(r.Sym.IsFileLocal() || r.Sym.Attr.VisibilityHidden() || r.Sym.Attr.Local()) && r.Sym.Type == sym.STEXT && target.IsDynlinkingGo() {
-                               if o2&0xffc00000 != 0xf9400000 {
-                                       ld.Errorf(s, "R_ARM64_GOTPCREL against unexpected instruction %x", o2)
-                               }
-                               o2 = 0x91000000 | (o2 & 0x000003ff)
-                               r.Type = objabi.R_ADDRARM64
-                       }
-                       if target.IsBigEndian() {
-                               val = int64(o1)<<32 | int64(o2)
-                       } else {
-                               val = int64(o2)<<32 | int64(o1)
-                       }
-                       fallthrough
-               case objabi.R_ADDRARM64:
+               case objabi.R_ARM64_GOTPCREL,
+                       objabi.R_ADDRARM64:
                        r.Done = false
 
                        // set up addend for eventual relocation via outer symbol.