]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: remove ARM64 special handling of GC data in shared libraries
authorCherry Zhang <cherryyz@google.com>
Fri, 10 Jul 2020 20:09:37 +0000 (16:09 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 10 Jul 2020 20:48:45 +0000 (20:48 +0000)
The special case is no longer needed, didn't actually work, and
we no longer even save this map anywhere (see CL 240621 for more
information).

Change-Id: I19bcf32cace22decf50fd6414d4519cc51cbb0be
Reviewed-on: https://go-review.googlesource.com/c/go/+/241982
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/link/internal/ld/lib.go

index 4121124eb0d7afae81ea42c650a1704138bce06e..a489da02bc95a720f4bab673706614f7ed73419d 100644 (file)
@@ -2038,7 +2038,6 @@ func ldshlibsyms(ctxt *Link, shlib string) {
                Errorf(nil, "cannot read symbols from shared library: %s", libpath)
                return
        }
-       gcdataLocations := make(map[uint64]loader.Sym)
        for _, elfsym := range syms {
                if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
                        continue
@@ -2085,7 +2084,6 @@ func ldshlibsyms(ctxt *Link, shlib string) {
                        sname := l.SymName(s)
                        if strings.HasPrefix(sname, "type.") && !strings.HasPrefix(sname, "type..") {
                                su.SetData(readelfsymboldata(ctxt, f, &elfsym))
-                               gcdataLocations[elfsym.Value+2*uint64(ctxt.Arch.PtrSize)+8+1*uint64(ctxt.Arch.PtrSize)] = s
                        }
                }
 
@@ -2106,28 +2104,6 @@ func ldshlibsyms(ctxt *Link, shlib string) {
                        su.AddReloc(loader.Reloc{Sym: s})
                }
        }
-       if ctxt.Arch.Family == sys.ARM64 {
-               for _, sect := range f.Sections {
-                       if sect.Type == elf.SHT_RELA {
-                               var rela elf.Rela64
-                               rdr := sect.Open()
-                               for {
-                                       err := binary.Read(rdr, f.ByteOrder, &rela)
-                                       if err == io.EOF {
-                                               break
-                                       } else if err != nil {
-                                               Errorf(nil, "reading relocation failed %v", err)
-                                               return
-                                       }
-                                       t := elf.R_AARCH64(rela.Info & 0xffff)
-                                       if t != elf.R_AARCH64_RELATIVE {
-                                               continue
-                                       }
-                               }
-                       }
-               }
-       }
-
        ctxt.Shlibs = append(ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f})
 }