]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: remove R_ADDR relocation workaround for macho arm64
authorElias Naur <elias.naur@gmail.com>
Sat, 21 Apr 2018 11:27:13 +0000 (13:27 +0200)
committerElias Naur <elias.naur@gmail.com>
Mon, 23 Apr 2018 16:00:55 +0000 (16:00 +0000)
The workarounds doesn't seem necessary anymore, and blocks DWARF
on darwin/arm64.

Updates #24883.

Change-Id: Ic917c767d3b4f6c51be25566956296f5dd4ead10
Reviewed-on: https://go-review.googlesource.com/108655
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/ld/data.go

index d8245590beaf40aa639d292adbb72d5c9cfaeafd..858363e45a9ba5114e434a1db536ab341a6a8ba2 100644 (file)
@@ -150,10 +150,7 @@ func machoreloc1(arch *sys.Arch, out *ld.OutBuf, s *sym.Symbol, r *sym.Reloc, se
 
        rs := r.Xsym
 
-       // ld64 has a bug handling MACHO_ARM64_RELOC_UNSIGNED with !extern relocation.
-       // see cmd/internal/ld/data.go for details. The workaround is that don't use !extern
-       // UNSIGNED relocation at all.
-       if rs.Type == sym.SHOSTOBJ || r.Type == objabi.R_CALLARM64 || r.Type == objabi.R_ADDRARM64 || r.Type == objabi.R_ADDR {
+       if rs.Type == sym.SHOSTOBJ || r.Type == objabi.R_CALLARM64 || r.Type == objabi.R_ADDRARM64 {
                if rs.Dynid < 0 {
                        ld.Errorf(s, "reloc %d (%s) to non-macho symbol %s type=%d (%s)", r.Type, sym.RelocName(arch, r.Type), rs.Name, rs.Type, rs.Type)
                        return false
index 1a42f924305ea9eb72b905aba19c2c80ea4d15a0..74faa7f8b291bf2d7f65de4d7104a36ed857b29e 100644 (file)
@@ -285,18 +285,8 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
                                                o = 0
                                        }
                                } else if ctxt.HeadType == objabi.Hdarwin {
-                                       // ld64 for arm64 has a bug where if the address pointed to by o exists in the
-                                       // symbol table (dynid >= 0), or is inside a symbol that exists in the symbol
-                                       // table, then it will add o twice into the relocated value.
-                                       // The workaround is that on arm64 don't ever add symaddr to o and always use
-                                       // extern relocation by requiring rs->dynid >= 0.
                                        if rs.Type != sym.SHOSTOBJ {
-                                               if ctxt.Arch.Family == sys.ARM64 && rs.Dynid < 0 {
-                                                       Errorf(s, "R_ADDR reloc to %s+%d is not supported on darwin/arm64", rs.Name, o)
-                                               }
-                                               if ctxt.Arch.Family != sys.ARM64 {
-                                                       o += Symaddr(rs)
-                                               }
+                                               o += Symaddr(rs)
                                        }
                                } else if ctxt.HeadType == objabi.Hwindows {
                                        // nothing to do