• Than McIntosh's avatar
    [dev.link] cmd/link/internal/objfile: new loader method for reloc queries · 0b25ab5d
    Than McIntosh authored
    Second change of several to update the loader API to reflect the final
    consensus version of the loader API as described in Cherry's doc.
    This piece:
    
     - define new loader.Relocs() method that returns a struct
       encapsulating a set of relocations on a global symbol
    
    Old way of examining relocations:
    
      nreloc := loader.NReloc(someGlobalSymbolIndex)
      for i := 0; i < nreloc; i++ {
        tgtIdx := loader.RelocSym(someGlobalSymbolIndex, i))
        ... <do something with tgtIdx>
      }
    
    New way of examining relocations:
    
      relocs := d.loader.Relocs(someGlobalSymbolIndex)
      for i := 0; i < relocs.Count; i++ {
        r := relocs.At(i).Sym
        ... <do something with r.Sym>
      }
    
    Change-Id: I5bead1d729655ea13b3396647e53aafcd3e60f97
    Reviewed-on: https://go-review.googlesource.com/c/go/+/200717
    Run-TryBot: Than McIntosh <thanm@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
    0b25ab5d
objfile2.go 19.9 KB