Commit a072fc2e authored by Michael Matloob's avatar Michael Matloob

cmd/link/internal: rename LSym to Symbol, and add a doc comment.

I'd also like to document some of its fields, but I don't know
what they are.

Change-Id: I87d341e255f785d351a8a73e645be668e02b2689
Reviewed-on: https://go-review.googlesource.com/27399Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0a2a64d8
...@@ -42,7 +42,7 @@ func PADDR(x uint32) uint32 { ...@@ -42,7 +42,7 @@ func PADDR(x uint32) uint32 {
return x &^ 0x80000000 return x &^ 0x80000000
} }
func Addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) int64 { func Addcall(ctxt *ld.Link, s *ld.Symbol, t *ld.Symbol) int64 {
s.Attr |= ld.AttrReachable s.Attr |= ld.AttrReachable
i := s.Size i := s.Size
s.Size += 4 s.Size += 4
...@@ -94,7 +94,7 @@ func gentext() { ...@@ -94,7 +94,7 @@ func gentext() {
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc) ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym targ := r.Sym
ld.Ctxt.Cursym = s ld.Ctxt.Cursym = s
...@@ -472,11 +472,11 @@ func pereloc1(r *ld.Reloc, sectoff int64) bool { ...@@ -472,11 +472,11 @@ func pereloc1(r *ld.Reloc, sectoff int64) bool {
return true return true
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
log.Fatalf("unexpected relocation variant") log.Fatalf("unexpected relocation variant")
return t return t
} }
...@@ -508,7 +508,7 @@ func elfsetupplt() { ...@@ -508,7 +508,7 @@ func elfsetupplt() {
} }
} }
func addpltsym(s *ld.LSym) { func addpltsym(s *ld.Symbol) {
if s.Plt >= 0 { if s.Plt >= 0 {
return return
} }
...@@ -576,7 +576,7 @@ func addpltsym(s *ld.LSym) { ...@@ -576,7 +576,7 @@ func addpltsym(s *ld.LSym) {
} }
} }
func addgotsym(s *ld.LSym) { func addgotsym(s *ld.Symbol) {
if s.Got >= 0 { if s.Got >= 0 {
return return
} }
......
...@@ -109,7 +109,7 @@ func braddoff(a int32, b int32) int32 { ...@@ -109,7 +109,7 @@ func braddoff(a int32, b int32) int32 {
return int32((uint32(a))&0xff000000 | 0x00ffffff&uint32(a+b)) return int32((uint32(a))&0xff000000 | 0x00ffffff&uint32(a+b))
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym targ := r.Sym
ld.Ctxt.Cursym = s ld.Ctxt.Cursym = s
...@@ -410,7 +410,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { ...@@ -410,7 +410,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int {
return 0 return 0
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
switch r.Type { switch r.Type {
case obj.R_CALLARM: case obj.R_CALLARM:
...@@ -487,12 +487,12 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -487,12 +487,12 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
log.Fatalf("unexpected relocation variant") log.Fatalf("unexpected relocation variant")
return t return t
} }
func addpltreloc(ctxt *ld.Link, plt *ld.LSym, got *ld.LSym, sym *ld.LSym, typ int) *ld.Reloc { func addpltreloc(ctxt *ld.Link, plt *ld.Symbol, got *ld.Symbol, sym *ld.Symbol, typ int) *ld.Reloc {
r := ld.Addrel(plt) r := ld.Addrel(plt)
r.Sym = got r.Sym = got
r.Off = int32(plt.Size) r.Off = int32(plt.Size)
...@@ -507,7 +507,7 @@ func addpltreloc(ctxt *ld.Link, plt *ld.LSym, got *ld.LSym, sym *ld.LSym, typ in ...@@ -507,7 +507,7 @@ func addpltreloc(ctxt *ld.Link, plt *ld.LSym, got *ld.LSym, sym *ld.LSym, typ in
return r return r
} }
func addpltsym(ctxt *ld.Link, s *ld.LSym) { func addpltsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Plt >= 0 { if s.Plt >= 0 {
return return
} }
...@@ -546,7 +546,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) { ...@@ -546,7 +546,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) {
} }
} }
func addgotsyminternal(ctxt *ld.Link, s *ld.LSym) { func addgotsyminternal(ctxt *ld.Link, s *ld.Symbol) {
if s.Got >= 0 { if s.Got >= 0 {
return return
} }
...@@ -562,7 +562,7 @@ func addgotsyminternal(ctxt *ld.Link, s *ld.LSym) { ...@@ -562,7 +562,7 @@ func addgotsyminternal(ctxt *ld.Link, s *ld.LSym) {
} }
} }
func addgotsym(ctxt *ld.Link, s *ld.LSym) { func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Got >= 0 { if s.Got >= 0 {
return return
} }
......
...@@ -86,7 +86,7 @@ func gentext() { ...@@ -86,7 +86,7 @@ func gentext() {
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc) ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
log.Fatalf("adddynrel not implemented") log.Fatalf("adddynrel not implemented")
} }
...@@ -226,7 +226,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { ...@@ -226,7 +226,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int {
return 0 return 0
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
switch r.Type { switch r.Type {
default: default:
...@@ -385,7 +385,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -385,7 +385,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
log.Fatalf("unexpected relocation variant") log.Fatalf("unexpected relocation variant")
return -1 return -1
} }
......
...@@ -44,7 +44,7 @@ import ( ...@@ -44,7 +44,7 @@ import (
"sync" "sync"
) )
func Symgrow(ctxt *Link, s *LSym, siz int64) { func Symgrow(ctxt *Link, s *Symbol, siz int64) {
if int64(int(siz)) != siz { if int64(int(siz)) != siz {
log.Fatalf("symgrow size %d too long", siz) log.Fatalf("symgrow size %d too long", siz)
} }
...@@ -58,12 +58,12 @@ func Symgrow(ctxt *Link, s *LSym, siz int64) { ...@@ -58,12 +58,12 @@ func Symgrow(ctxt *Link, s *LSym, siz int64) {
s.P = s.P[:siz] s.P = s.P[:siz]
} }
func Addrel(s *LSym) *Reloc { func Addrel(s *Symbol) *Reloc {
s.R = append(s.R, Reloc{}) s.R = append(s.R, Reloc{})
return &s.R[len(s.R)-1] return &s.R[len(s.R)-1]
} }
func setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 { func setuintxx(ctxt *Link, s *Symbol, off int64, v uint64, wid int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -87,7 +87,7 @@ func setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 { ...@@ -87,7 +87,7 @@ func setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 {
return off + wid return off + wid
} }
func Addbytes(ctxt *Link, s *LSym, bytes []byte) int64 { func Addbytes(ctxt *Link, s *Symbol, bytes []byte) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -98,13 +98,13 @@ func Addbytes(ctxt *Link, s *LSym, bytes []byte) int64 { ...@@ -98,13 +98,13 @@ func Addbytes(ctxt *Link, s *LSym, bytes []byte) int64 {
return s.Size return s.Size
} }
func adduintxx(ctxt *Link, s *LSym, v uint64, wid int) int64 { func adduintxx(ctxt *Link, s *Symbol, v uint64, wid int) int64 {
off := s.Size off := s.Size
setuintxx(ctxt, s, off, v, int64(wid)) setuintxx(ctxt, s, off, v, int64(wid))
return off return off
} }
func Adduint8(ctxt *Link, s *LSym, v uint8) int64 { func Adduint8(ctxt *Link, s *Symbol, v uint8) int64 {
off := s.Size off := s.Size
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
...@@ -116,31 +116,31 @@ func Adduint8(ctxt *Link, s *LSym, v uint8) int64 { ...@@ -116,31 +116,31 @@ func Adduint8(ctxt *Link, s *LSym, v uint8) int64 {
return off return off
} }
func Adduint16(ctxt *Link, s *LSym, v uint16) int64 { func Adduint16(ctxt *Link, s *Symbol, v uint16) int64 {
return adduintxx(ctxt, s, uint64(v), 2) return adduintxx(ctxt, s, uint64(v), 2)
} }
func Adduint32(ctxt *Link, s *LSym, v uint32) int64 { func Adduint32(ctxt *Link, s *Symbol, v uint32) int64 {
return adduintxx(ctxt, s, uint64(v), 4) return adduintxx(ctxt, s, uint64(v), 4)
} }
func Adduint64(ctxt *Link, s *LSym, v uint64) int64 { func Adduint64(ctxt *Link, s *Symbol, v uint64) int64 {
return adduintxx(ctxt, s, v, 8) return adduintxx(ctxt, s, v, 8)
} }
func adduint(ctxt *Link, s *LSym, v uint64) int64 { func adduint(ctxt *Link, s *Symbol, v uint64) int64 {
return adduintxx(ctxt, s, v, SysArch.IntSize) return adduintxx(ctxt, s, v, SysArch.IntSize)
} }
func setuint8(ctxt *Link, s *LSym, r int64, v uint8) int64 { func setuint8(ctxt *Link, s *Symbol, r int64, v uint8) int64 {
return setuintxx(ctxt, s, r, uint64(v), 1) return setuintxx(ctxt, s, r, uint64(v), 1)
} }
func setuint32(ctxt *Link, s *LSym, r int64, v uint32) int64 { func setuint32(ctxt *Link, s *Symbol, r int64, v uint32) int64 {
return setuintxx(ctxt, s, r, uint64(v), 4) return setuintxx(ctxt, s, r, uint64(v), 4)
} }
func Addaddrplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { func Addaddrplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -157,7 +157,7 @@ func Addaddrplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -157,7 +157,7 @@ func Addaddrplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
return i + int64(r.Siz) return i + int64(r.Siz)
} }
func Addpcrelplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { func Addpcrelplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -177,11 +177,11 @@ func Addpcrelplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -177,11 +177,11 @@ func Addpcrelplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
return i + int64(r.Siz) return i + int64(r.Siz)
} }
func Addaddr(ctxt *Link, s *LSym, t *LSym) int64 { func Addaddr(ctxt *Link, s *Symbol, t *Symbol) int64 {
return Addaddrplus(ctxt, s, t, 0) return Addaddrplus(ctxt, s, t, 0)
} }
func setaddrplus(ctxt *Link, s *LSym, off int64, t *LSym, add int64) int64 { func setaddrplus(ctxt *Link, s *Symbol, off int64, t *Symbol, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -200,11 +200,11 @@ func setaddrplus(ctxt *Link, s *LSym, off int64, t *LSym, add int64) int64 { ...@@ -200,11 +200,11 @@ func setaddrplus(ctxt *Link, s *LSym, off int64, t *LSym, add int64) int64 {
return off + int64(r.Siz) return off + int64(r.Siz)
} }
func setaddr(ctxt *Link, s *LSym, off int64, t *LSym) int64 { func setaddr(ctxt *Link, s *Symbol, off int64, t *Symbol) int64 {
return setaddrplus(ctxt, s, off, t, 0) return setaddrplus(ctxt, s, off, t, 0)
} }
func addsize(ctxt *Link, s *LSym, t *LSym) int64 { func addsize(ctxt *Link, s *Symbol, t *Symbol) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -220,7 +220,7 @@ func addsize(ctxt *Link, s *LSym, t *LSym) int64 { ...@@ -220,7 +220,7 @@ func addsize(ctxt *Link, s *LSym, t *LSym) int64 {
return i + int64(r.Siz) return i + int64(r.Siz)
} }
func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 { func addaddrplus4(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SDATA s.Type = obj.SDATA
} }
...@@ -243,11 +243,11 @@ func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -243,11 +243,11 @@ func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
* Used for the data block. * Used for the data block.
*/ */
func listsubp(s *LSym) **LSym { func listsubp(s *Symbol) **Symbol {
return &s.Sub return &s.Sub
} }
func listsort(l *LSym, cmp func(*LSym, *LSym) int, nextp func(*LSym) **LSym) *LSym { func listsort(l *Symbol, cmp func(*Symbol, *Symbol) int, nextp func(*Symbol) **Symbol) *Symbol {
if l == nil || *nextp(l) == nil { if l == nil || *nextp(l) == nil {
return l return l
} }
...@@ -319,9 +319,9 @@ func listsort(l *LSym, cmp func(*LSym, *LSym) int, nextp func(*LSym) **LSym) *LS ...@@ -319,9 +319,9 @@ func listsort(l *LSym, cmp func(*LSym, *LSym) int, nextp func(*LSym) **LSym) *LS
return l return l
} }
func relocsym(s *LSym) { func relocsym(s *Symbol) {
var r *Reloc var r *Reloc
var rs *LSym var rs *Symbol
var i16 int16 var i16 int16
var off int32 var off int32
var siz int32 var siz int32
...@@ -668,7 +668,7 @@ func reloc() { ...@@ -668,7 +668,7 @@ func reloc() {
} }
} }
func dynrelocsym(s *LSym) { func dynrelocsym(s *Symbol) {
if HEADTYPE == obj.Hwindows && Linkmode != LinkExternal { if HEADTYPE == obj.Hwindows && Linkmode != LinkExternal {
rel := Linklookup(Ctxt, ".rel", 0) rel := Linklookup(Ctxt, ".rel", 0)
if s == rel { if s == rel {
...@@ -722,7 +722,7 @@ func dynrelocsym(s *LSym) { ...@@ -722,7 +722,7 @@ func dynrelocsym(s *LSym) {
} }
} }
func dynreloc(data *[obj.SXREF][]*LSym) { func dynreloc(data *[obj.SXREF][]*Symbol) {
// -d suppresses dynamic loader format, so we may as well not // -d suppresses dynamic loader format, so we may as well not
// compute these sections or mark their symbols as reachable. // compute these sections or mark their symbols as reachable.
if Debug['d'] != 0 && HEADTYPE != obj.Hwindows { if Debug['d'] != 0 && HEADTYPE != obj.Hwindows {
...@@ -746,8 +746,8 @@ func dynreloc(data *[obj.SXREF][]*LSym) { ...@@ -746,8 +746,8 @@ func dynreloc(data *[obj.SXREF][]*LSym) {
} }
} }
func blk(start *LSym, addr int64, size int64) { func blk(start *Symbol, addr int64, size int64) {
var sym *LSym var sym *Symbol
for sym = start; sym != nil; sym = sym.Next { for sym = start; sym != nil; sym = sym.Next {
if sym.Type&obj.SSUB == 0 && sym.Value >= addr { if sym.Type&obj.SSUB == 0 && sym.Value >= addr {
...@@ -867,7 +867,7 @@ func CodeblkPad(addr int64, size int64, pad []byte) { ...@@ -867,7 +867,7 @@ func CodeblkPad(addr int64, size int64, pad []byte) {
// blkSlice is a variant of blk that processes slices. // blkSlice is a variant of blk that processes slices.
// After text symbols are converted from a linked list to a slice, // After text symbols are converted from a linked list to a slice,
// delete blk and give this function its name. // delete blk and give this function its name.
func blkSlice(syms []*LSym, addr, size int64, pad []byte) { func blkSlice(syms []*Symbol, addr, size int64, pad []byte) {
for i, s := range syms { for i, s := range syms {
if s.Type&obj.SSUB == 0 && s.Value >= addr { if s.Type&obj.SSUB == 0 && s.Value >= addr {
syms = syms[i:] syms = syms[i:]
...@@ -1019,7 +1019,7 @@ func strnputPad(s string, n int, pad []byte) { ...@@ -1019,7 +1019,7 @@ func strnputPad(s string, n int, pad []byte) {
} }
} }
var strdata []*LSym var strdata []*Symbol
func addstrdata1(arg string) { func addstrdata1(arg string) {
i := strings.Index(arg, "=") i := strings.Index(arg, "=")
...@@ -1063,7 +1063,7 @@ func checkstrdata() { ...@@ -1063,7 +1063,7 @@ func checkstrdata() {
} }
} }
func Addstring(s *LSym, str string) int64 { func Addstring(s *Symbol, str string) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SNOPTRDATA s.Type = obj.SNOPTRDATA
} }
...@@ -1080,7 +1080,7 @@ func Addstring(s *LSym, str string) int64 { ...@@ -1080,7 +1080,7 @@ func Addstring(s *LSym, str string) int64 {
// addgostring adds str, as a Go string value, to s. symname is the name of the // addgostring adds str, as a Go string value, to s. symname is the name of the
// symbol used to define the string data and must be unique per linked object. // symbol used to define the string data and must be unique per linked object.
func addgostring(s *LSym, symname, str string) { func addgostring(s *Symbol, symname, str string) {
sym := Linklookup(Ctxt, symname, 0) sym := Linklookup(Ctxt, symname, 0)
if sym.Type != obj.Sxxx { if sym.Type != obj.Sxxx {
Diag("duplicate symname in addgostring: %s", symname) Diag("duplicate symname in addgostring: %s", symname)
...@@ -1094,7 +1094,7 @@ func addgostring(s *LSym, symname, str string) { ...@@ -1094,7 +1094,7 @@ func addgostring(s *LSym, symname, str string) {
adduint(Ctxt, s, uint64(len(str))) adduint(Ctxt, s, uint64(len(str)))
} }
func addinitarrdata(s *LSym) { func addinitarrdata(s *Symbol) {
p := s.Name + ".ptr" p := s.Name + ".ptr"
sp := Linklookup(Ctxt, p, 0) sp := Linklookup(Ctxt, p, 0)
sp.Type = obj.SINITARR sp.Type = obj.SINITARR
...@@ -1125,7 +1125,7 @@ func dosymtype() { ...@@ -1125,7 +1125,7 @@ func dosymtype() {
} }
// symalign returns the required alignment for the given symbol s. // symalign returns the required alignment for the given symbol s.
func symalign(s *LSym) int32 { func symalign(s *Symbol) int32 {
min := int32(Thearch.Minalign) min := int32(Thearch.Minalign)
if s.Align >= min { if s.Align >= min {
return s.Align return s.Align
...@@ -1144,14 +1144,14 @@ func symalign(s *LSym) int32 { ...@@ -1144,14 +1144,14 @@ func symalign(s *LSym) int32 {
return align return align
} }
func aligndatsize(datsize int64, s *LSym) int64 { func aligndatsize(datsize int64, s *Symbol) int64 {
return Rnd(datsize, int64(symalign(s))) return Rnd(datsize, int64(symalign(s)))
} }
const debugGCProg = false const debugGCProg = false
type GCProg struct { type GCProg struct {
sym *LSym sym *Symbol
w gcprog.Writer w gcprog.Writer
} }
...@@ -1176,7 +1176,7 @@ func (p *GCProg) End(size int64) { ...@@ -1176,7 +1176,7 @@ func (p *GCProg) End(size int64) {
} }
} }
func (p *GCProg) AddSym(s *LSym) { func (p *GCProg) AddSym(s *Symbol) {
typ := s.Gotype typ := s.Gotype
// Things without pointers should be in SNOPTRDATA or SNOPTRBSS; // Things without pointers should be in SNOPTRDATA or SNOPTRBSS;
// everything we see should have pointers and should therefore have a type. // everything we see should have pointers and should therefore have a type.
...@@ -1214,7 +1214,7 @@ func (p *GCProg) AddSym(s *LSym) { ...@@ -1214,7 +1214,7 @@ func (p *GCProg) AddSym(s *LSym) {
type dataSortKey struct { type dataSortKey struct {
size int64 size int64
name string name string
lsym *LSym lsym *Symbol
} }
type bySizeAndName []dataSortKey type bySizeAndName []dataSortKey
...@@ -1237,8 +1237,8 @@ func checkdatsize(datsize int64, symn int) { ...@@ -1237,8 +1237,8 @@ func checkdatsize(datsize int64, symn int) {
} }
} }
func list2slice(s *LSym) []*LSym { func list2slice(s *Symbol) []*Symbol {
var syms []*LSym var syms []*Symbol
for ; s != nil; s = s.Next { for ; s != nil; s = s.Next {
syms = append(syms, s) syms = append(syms, s)
} }
...@@ -1247,7 +1247,7 @@ func list2slice(s *LSym) []*LSym { ...@@ -1247,7 +1247,7 @@ func list2slice(s *LSym) []*LSym {
// datap is a collection of reachable data symbols in address order. // datap is a collection of reachable data symbols in address order.
// Generated by dodata. // Generated by dodata.
var datap []*LSym var datap []*Symbol
func dodata() { func dodata() {
if Debug['v'] != 0 { if Debug['v'] != 0 {
...@@ -1256,7 +1256,7 @@ func dodata() { ...@@ -1256,7 +1256,7 @@ func dodata() {
Bso.Flush() Bso.Flush()
// Collect data symbols by type into data. // Collect data symbols by type into data.
var data [obj.SXREF][]*LSym var data [obj.SXREF][]*Symbol
for _, s := range Ctxt.Allsym { for _, s := range Ctxt.Allsym {
if !s.Attr.Reachable() || s.Attr.Special() { if !s.Attr.Reachable() || s.Attr.Special() {
continue continue
...@@ -1285,7 +1285,7 @@ func dodata() { ...@@ -1285,7 +1285,7 @@ func dodata() {
for symnro := int16(obj.STYPE); symnro < obj.STYPERELRO; symnro++ { for symnro := int16(obj.STYPE); symnro < obj.STYPERELRO; symnro++ {
symnrelro := symnro + obj.STYPERELRO - obj.STYPE symnrelro := symnro + obj.STYPERELRO - obj.STYPE
ro := []*LSym{} ro := []*Symbol{}
relro := data[symnrelro] relro := data[symnrelro]
for _, s := range data[symnro] { for _, s := range data[symnro] {
...@@ -1371,7 +1371,7 @@ func dodata() { ...@@ -1371,7 +1371,7 @@ func dodata() {
sect.Align = dataMaxAlign[obj.SELFGOT] sect.Align = dataMaxAlign[obj.SELFGOT]
datsize = Rnd(datsize, int64(sect.Align)) datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize) sect.Vaddr = uint64(datsize)
var toc *LSym var toc *Symbol
for _, s := range data[obj.SELFGOT] { for _, s := range data[obj.SELFGOT] {
datsize = aligndatsize(datsize, s) datsize = aligndatsize(datsize, s)
s.Sect = sect s.Sect = sect
...@@ -1753,7 +1753,7 @@ func dodata() { ...@@ -1753,7 +1753,7 @@ func dodata() {
dwarfgeneratedebugsyms() dwarfgeneratedebugsyms()
var s *LSym var s *Symbol
for s = dwarfp; s != nil && s.Type == obj.SDWARFSECT; s = s.Next { for s = dwarfp; s != nil && s.Type == obj.SDWARFSECT; s = s.Next {
sect = addsection(&Segdwarf, s.Name, 04) sect = addsection(&Segdwarf, s.Name, 04)
sect.Align = 1 sect.Align = 1
...@@ -1804,11 +1804,11 @@ func dodata() { ...@@ -1804,11 +1804,11 @@ func dodata() {
} }
} }
func dodataSect(symn int, syms []*LSym) (result []*LSym, maxAlign int32) { func dodataSect(symn int, syms []*Symbol) (result []*Symbol, maxAlign int32) {
if HEADTYPE == obj.Hdarwin { if HEADTYPE == obj.Hdarwin {
// Some symbols may no longer belong in syms // Some symbols may no longer belong in syms
// due to movement in machosymorder. // due to movement in machosymorder.
newSyms := make([]*LSym, 0, len(syms)) newSyms := make([]*Symbol, 0, len(syms))
for _, s := range syms { for _, s := range syms {
if int(s.Type) == symn { if int(s.Type) == symn {
newSyms = append(newSyms, s) newSyms = append(newSyms, s)
......
...@@ -119,7 +119,7 @@ func deadcode(ctxt *Link) { ...@@ -119,7 +119,7 @@ func deadcode(ctxt *Link) {
} }
// Remove dead text but keep file information (z symbols). // Remove dead text but keep file information (z symbols).
textp := make([]*LSym, 0, len(ctxt.Textp)) textp := make([]*Symbol, 0, len(ctxt.Textp))
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
if s.Attr.Reachable() { if s.Attr.Reachable() {
textp = append(textp, s) textp = append(textp, s)
...@@ -154,11 +154,11 @@ var markextra = []string{ ...@@ -154,11 +154,11 @@ var markextra = []string{
// the reflect.method struct: mtyp, ifn, and tfn. // the reflect.method struct: mtyp, ifn, and tfn.
type methodref struct { type methodref struct {
m methodsig m methodsig
src *LSym // receiver type symbol src *Symbol // receiver type symbol
r [3]*Reloc // R_METHODOFF relocations to fields of runtime.method r [3]*Reloc // R_METHODOFF relocations to fields of runtime.method
} }
func (m methodref) ifn() *LSym { return m.r[1].Sym } func (m methodref) ifn() *Symbol { return m.r[1].Sym }
func (m methodref) isExported() bool { func (m methodref) isExported() bool {
for _, r := range m.m { for _, r := range m.m {
...@@ -170,7 +170,7 @@ func (m methodref) isExported() bool { ...@@ -170,7 +170,7 @@ func (m methodref) isExported() bool {
// deadcodepass holds state for the deadcode flood fill. // deadcodepass holds state for the deadcode flood fill.
type deadcodepass struct { type deadcodepass struct {
ctxt *Link ctxt *Link
markQueue []*LSym // symbols to flood fill in next pass markQueue []*Symbol // symbols to flood fill in next pass
ifaceMethod map[methodsig]bool // methods declared in reached interfaces ifaceMethod map[methodsig]bool // methods declared in reached interfaces
markableMethods []methodref // methods of reached types markableMethods []methodref // methods of reached types
reflectMethod bool reflectMethod bool
...@@ -189,7 +189,7 @@ func (d *deadcodepass) cleanupReloc(r *Reloc) { ...@@ -189,7 +189,7 @@ func (d *deadcodepass) cleanupReloc(r *Reloc) {
} }
// mark appends a symbol to the mark queue for flood filling. // mark appends a symbol to the mark queue for flood filling.
func (d *deadcodepass) mark(s, parent *LSym) { func (d *deadcodepass) mark(s, parent *Symbol) {
if s == nil || s.Attr.Reachable() { if s == nil || s.Attr.Reachable() {
return return
} }
......
...@@ -28,7 +28,7 @@ const ( ...@@ -28,7 +28,7 @@ const (
tflagExtraStar = 1 << 1 tflagExtraStar = 1 << 1
) )
func decode_reloc(s *LSym, off int32) *Reloc { func decode_reloc(s *Symbol, off int32) *Reloc {
for i := range s.R { for i := range s.R {
if s.R[i].Off == off { if s.R[i].Off == off {
return &s.R[i] return &s.R[i]
...@@ -37,7 +37,7 @@ func decode_reloc(s *LSym, off int32) *Reloc { ...@@ -37,7 +37,7 @@ func decode_reloc(s *LSym, off int32) *Reloc {
return nil return nil
} }
func decode_reloc_sym(s *LSym, off int32) *LSym { func decode_reloc_sym(s *Symbol, off int32) *Symbol {
r := decode_reloc(s, off) r := decode_reloc(s, off)
if r == nil { if r == nil {
return nil return nil
...@@ -64,27 +64,27 @@ func structfieldSize() int { return 3 * SysArch.PtrSize } // runtime.struc ...@@ -64,27 +64,27 @@ func structfieldSize() int { return 3 * SysArch.PtrSize } // runtime.struc
func uncommonSize() int { return 4 + 2 + 2 + 4 + 4 } // runtime.uncommontype func uncommonSize() int { return 4 + 2 + 2 + 4 + 4 } // runtime.uncommontype
// Type.commonType.kind // Type.commonType.kind
func decodetype_kind(s *LSym) uint8 { func decodetype_kind(s *Symbol) uint8 {
return s.P[2*SysArch.PtrSize+7] & obj.KindMask // 0x13 / 0x1f return s.P[2*SysArch.PtrSize+7] & obj.KindMask // 0x13 / 0x1f
} }
// Type.commonType.kind // Type.commonType.kind
func decodetype_usegcprog(s *LSym) uint8 { func decodetype_usegcprog(s *Symbol) uint8 {
return s.P[2*SysArch.PtrSize+7] & obj.KindGCProg // 0x13 / 0x1f return s.P[2*SysArch.PtrSize+7] & obj.KindGCProg // 0x13 / 0x1f
} }
// Type.commonType.size // Type.commonType.size
func decodetype_size(s *LSym) int64 { func decodetype_size(s *Symbol) int64 {
return int64(decode_inuxi(s.P, SysArch.PtrSize)) // 0x8 / 0x10 return int64(decode_inuxi(s.P, SysArch.PtrSize)) // 0x8 / 0x10
} }
// Type.commonType.ptrdata // Type.commonType.ptrdata
func decodetype_ptrdata(s *LSym) int64 { func decodetype_ptrdata(s *Symbol) int64 {
return int64(decode_inuxi(s.P[SysArch.PtrSize:], SysArch.PtrSize)) // 0x8 / 0x10 return int64(decode_inuxi(s.P[SysArch.PtrSize:], SysArch.PtrSize)) // 0x8 / 0x10
} }
// Type.commonType.tflag // Type.commonType.tflag
func decodetype_hasUncommon(s *LSym) bool { func decodetype_hasUncommon(s *Symbol) bool {
return s.P[2*SysArch.PtrSize+4]&tflagUncommon != 0 return s.P[2*SysArch.PtrSize+4]&tflagUncommon != 0
} }
...@@ -103,7 +103,7 @@ func findShlibSection(path string, addr uint64) *elf.Section { ...@@ -103,7 +103,7 @@ func findShlibSection(path string, addr uint64) *elf.Section {
} }
// Type.commonType.gc // Type.commonType.gc
func decodetype_gcprog(s *LSym) []byte { func decodetype_gcprog(s *Symbol) []byte {
if s.Type == obj.SDYNIMPORT { if s.Type == obj.SDYNIMPORT {
addr := decodetype_gcprog_shlib(s) addr := decodetype_gcprog_shlib(s)
sect := findShlibSection(s.File, addr) sect := findShlibSection(s.File, addr)
...@@ -122,7 +122,7 @@ func decodetype_gcprog(s *LSym) []byte { ...@@ -122,7 +122,7 @@ func decodetype_gcprog(s *LSym) []byte {
return decode_reloc_sym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize)).P return decode_reloc_sym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize)).P
} }
func decodetype_gcprog_shlib(s *LSym) uint64 { func decodetype_gcprog_shlib(s *Symbol) uint64 {
if SysArch.Family == sys.ARM64 { if SysArch.Family == sys.ARM64 {
for _, shlib := range Ctxt.Shlibs { for _, shlib := range Ctxt.Shlibs {
if shlib.Path == s.File { if shlib.Path == s.File {
...@@ -134,7 +134,7 @@ func decodetype_gcprog_shlib(s *LSym) uint64 { ...@@ -134,7 +134,7 @@ func decodetype_gcprog_shlib(s *LSym) uint64 {
return decode_inuxi(s.P[2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize):], SysArch.PtrSize) return decode_inuxi(s.P[2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize):], SysArch.PtrSize)
} }
func decodetype_gcmask(s *LSym) []byte { func decodetype_gcmask(s *Symbol) []byte {
if s.Type == obj.SDYNIMPORT { if s.Type == obj.SDYNIMPORT {
addr := decodetype_gcprog_shlib(s) addr := decodetype_gcprog_shlib(s)
ptrdata := decodetype_ptrdata(s) ptrdata := decodetype_ptrdata(s)
...@@ -152,48 +152,48 @@ func decodetype_gcmask(s *LSym) []byte { ...@@ -152,48 +152,48 @@ func decodetype_gcmask(s *LSym) []byte {
} }
// Type.ArrayType.elem and Type.SliceType.Elem // Type.ArrayType.elem and Type.SliceType.Elem
func decodetype_arrayelem(s *LSym) *LSym { func decodetype_arrayelem(s *Symbol) *Symbol {
return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30 return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
} }
func decodetype_arraylen(s *LSym) int64 { func decodetype_arraylen(s *Symbol) int64 {
return int64(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.PtrSize)) return int64(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.PtrSize))
} }
// Type.PtrType.elem // Type.PtrType.elem
func decodetype_ptrelem(s *LSym) *LSym { func decodetype_ptrelem(s *Symbol) *Symbol {
return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30 return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
} }
// Type.MapType.key, elem // Type.MapType.key, elem
func decodetype_mapkey(s *LSym) *LSym { func decodetype_mapkey(s *Symbol) *Symbol {
return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30 return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
} }
func decodetype_mapvalue(s *LSym) *LSym { func decodetype_mapvalue(s *Symbol) *Symbol {
return decode_reloc_sym(s, int32(commonsize())+int32(SysArch.PtrSize)) // 0x20 / 0x38 return decode_reloc_sym(s, int32(commonsize())+int32(SysArch.PtrSize)) // 0x20 / 0x38
} }
// Type.ChanType.elem // Type.ChanType.elem
func decodetype_chanelem(s *LSym) *LSym { func decodetype_chanelem(s *Symbol) *Symbol {
return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30 return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
} }
// Type.FuncType.dotdotdot // Type.FuncType.dotdotdot
func decodetype_funcdotdotdot(s *LSym) bool { func decodetype_funcdotdotdot(s *Symbol) bool {
return uint16(decode_inuxi(s.P[commonsize()+2:], 2))&(1<<15) != 0 return uint16(decode_inuxi(s.P[commonsize()+2:], 2))&(1<<15) != 0
} }
// Type.FuncType.inCount // Type.FuncType.inCount
func decodetype_funcincount(s *LSym) int { func decodetype_funcincount(s *Symbol) int {
return int(decode_inuxi(s.P[commonsize():], 2)) return int(decode_inuxi(s.P[commonsize():], 2))
} }
func decodetype_funcoutcount(s *LSym) int { func decodetype_funcoutcount(s *Symbol) int {
return int(uint16(decode_inuxi(s.P[commonsize()+2:], 2)) & (1<<15 - 1)) return int(uint16(decode_inuxi(s.P[commonsize()+2:], 2)) & (1<<15 - 1))
} }
func decodetype_funcintype(s *LSym, i int) *LSym { func decodetype_funcintype(s *Symbol, i int) *Symbol {
uadd := commonsize() + 4 uadd := commonsize() + 4
if SysArch.PtrSize == 8 { if SysArch.PtrSize == 8 {
uadd += 4 uadd += 4
...@@ -204,16 +204,16 @@ func decodetype_funcintype(s *LSym, i int) *LSym { ...@@ -204,16 +204,16 @@ func decodetype_funcintype(s *LSym, i int) *LSym {
return decode_reloc_sym(s, int32(uadd+i*SysArch.PtrSize)) return decode_reloc_sym(s, int32(uadd+i*SysArch.PtrSize))
} }
func decodetype_funcouttype(s *LSym, i int) *LSym { func decodetype_funcouttype(s *Symbol, i int) *Symbol {
return decodetype_funcintype(s, i+decodetype_funcincount(s)) return decodetype_funcintype(s, i+decodetype_funcincount(s))
} }
// Type.StructType.fields.Slice::length // Type.StructType.fields.Slice::length
func decodetype_structfieldcount(s *LSym) int { func decodetype_structfieldcount(s *Symbol) int {
return int(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize)) return int(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
} }
func decodetype_structfieldarrayoff(s *LSym, i int) int { func decodetype_structfieldarrayoff(s *Symbol, i int) int {
off := commonsize() + 2*SysArch.PtrSize + 2*SysArch.IntSize off := commonsize() + 2*SysArch.PtrSize + 2*SysArch.IntSize
if decodetype_hasUncommon(s) { if decodetype_hasUncommon(s) {
off += uncommonSize() off += uncommonSize()
...@@ -223,7 +223,7 @@ func decodetype_structfieldarrayoff(s *LSym, i int) int { ...@@ -223,7 +223,7 @@ func decodetype_structfieldarrayoff(s *LSym, i int) int {
} }
// decodetype_str returns the contents of an rtype's str field (a nameOff). // decodetype_str returns the contents of an rtype's str field (a nameOff).
func decodetype_str(s *LSym) string { func decodetype_str(s *Symbol) string {
str := decodetype_name(s, 4*SysArch.PtrSize+8) str := decodetype_name(s, 4*SysArch.PtrSize+8)
if s.P[2*SysArch.PtrSize+4]&tflagExtraStar != 0 { if s.P[2*SysArch.PtrSize+4]&tflagExtraStar != 0 {
return str[1:] return str[1:]
...@@ -232,7 +232,7 @@ func decodetype_str(s *LSym) string { ...@@ -232,7 +232,7 @@ func decodetype_str(s *LSym) string {
} }
// decodetype_name decodes the name from a reflect.name. // decodetype_name decodes the name from a reflect.name.
func decodetype_name(s *LSym, off int) string { func decodetype_name(s *Symbol, off int) string {
r := decode_reloc(s, int32(off)) r := decode_reloc(s, int32(off))
if r == nil { if r == nil {
return "" return ""
...@@ -243,23 +243,23 @@ func decodetype_name(s *LSym, off int) string { ...@@ -243,23 +243,23 @@ func decodetype_name(s *LSym, off int) string {
return string(data[3 : 3+namelen]) return string(data[3 : 3+namelen])
} }
func decodetype_structfieldname(s *LSym, i int) string { func decodetype_structfieldname(s *Symbol, i int) string {
off := decodetype_structfieldarrayoff(s, i) off := decodetype_structfieldarrayoff(s, i)
return decodetype_name(s, off) return decodetype_name(s, off)
} }
func decodetype_structfieldtype(s *LSym, i int) *LSym { func decodetype_structfieldtype(s *Symbol, i int) *Symbol {
off := decodetype_structfieldarrayoff(s, i) off := decodetype_structfieldarrayoff(s, i)
return decode_reloc_sym(s, int32(off+SysArch.PtrSize)) return decode_reloc_sym(s, int32(off+SysArch.PtrSize))
} }
func decodetype_structfieldoffs(s *LSym, i int) int64 { func decodetype_structfieldoffs(s *Symbol, i int) int64 {
off := decodetype_structfieldarrayoff(s, i) off := decodetype_structfieldarrayoff(s, i)
return int64(decode_inuxi(s.P[off+2*SysArch.PtrSize:], SysArch.IntSize)) return int64(decode_inuxi(s.P[off+2*SysArch.PtrSize:], SysArch.IntSize))
} }
// InterfaceType.methods.length // InterfaceType.methods.length
func decodetype_ifacemethodcount(s *LSym) int64 { func decodetype_ifacemethodcount(s *Symbol) int64 {
return int64(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize)) return int64(decode_inuxi(s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
} }
...@@ -286,7 +286,7 @@ const ( ...@@ -286,7 +286,7 @@ const (
// the function type. // the function type.
// //
// Conveniently this is the layout of both runtime.method and runtime.imethod. // Conveniently this is the layout of both runtime.method and runtime.imethod.
func decode_methodsig(s *LSym, off, size, count int) []methodsig { func decode_methodsig(s *Symbol, off, size, count int) []methodsig {
var buf bytes.Buffer var buf bytes.Buffer
var methods []methodsig var methods []methodsig
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
...@@ -318,7 +318,7 @@ func decode_methodsig(s *LSym, off, size, count int) []methodsig { ...@@ -318,7 +318,7 @@ func decode_methodsig(s *LSym, off, size, count int) []methodsig {
return methods return methods
} }
func decodetype_ifacemethods(s *LSym) []methodsig { func decodetype_ifacemethods(s *Symbol) []methodsig {
if decodetype_kind(s)&kindMask != kindInterface { if decodetype_kind(s)&kindMask != kindInterface {
panic(fmt.Sprintf("symbol %q is not an interface", s.Name)) panic(fmt.Sprintf("symbol %q is not an interface", s.Name))
} }
...@@ -335,7 +335,7 @@ func decodetype_ifacemethods(s *LSym) []methodsig { ...@@ -335,7 +335,7 @@ func decodetype_ifacemethods(s *LSym) []methodsig {
return decode_methodsig(s, off, sizeofIMethod, numMethods) return decode_methodsig(s, off, sizeofIMethod, numMethods)
} }
func decodetype_methods(s *LSym) []methodsig { func decodetype_methods(s *Symbol) []methodsig {
if !decodetype_hasUncommon(s) { if !decodetype_hasUncommon(s) {
panic(fmt.Sprintf("no methods on %q", s.Name)) panic(fmt.Sprintf("no methods on %q", s.Name))
} }
......
...@@ -29,37 +29,37 @@ func (c dwCtxt) PtrSize() int { ...@@ -29,37 +29,37 @@ func (c dwCtxt) PtrSize() int {
return SysArch.PtrSize return SysArch.PtrSize
} }
func (c dwCtxt) AddInt(s dwarf.Sym, size int, i int64) { func (c dwCtxt) AddInt(s dwarf.Sym, size int, i int64) {
ls := s.(*LSym) ls := s.(*Symbol)
adduintxx(Ctxt, ls, uint64(i), size) adduintxx(Ctxt, ls, uint64(i), size)
} }
func (c dwCtxt) AddBytes(s dwarf.Sym, b []byte) { func (c dwCtxt) AddBytes(s dwarf.Sym, b []byte) {
ls := s.(*LSym) ls := s.(*Symbol)
Addbytes(Ctxt, ls, b) Addbytes(Ctxt, ls, b)
} }
func (c dwCtxt) AddString(s dwarf.Sym, v string) { func (c dwCtxt) AddString(s dwarf.Sym, v string) {
Addstring(s.(*LSym), v) Addstring(s.(*Symbol), v)
} }
func (c dwCtxt) SymValue(s dwarf.Sym) int64 { func (c dwCtxt) SymValue(s dwarf.Sym) int64 {
return s.(*LSym).Value return s.(*Symbol).Value
} }
func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) { func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
if value != 0 { if value != 0 {
value -= (data.(*LSym)).Value value -= (data.(*Symbol)).Value
} }
Addaddrplus(Ctxt, s.(*LSym), data.(*LSym), value) Addaddrplus(Ctxt, s.(*Symbol), data.(*Symbol), value)
} }
func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) { func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) {
ls := s.(*LSym) ls := s.(*Symbol)
switch size { switch size {
default: default:
Diag("invalid size %d in adddwarfref\n", size) Diag("invalid size %d in adddwarfref\n", size)
fallthrough fallthrough
case SysArch.PtrSize: case SysArch.PtrSize:
Addaddr(Ctxt, ls, t.(*LSym)) Addaddr(Ctxt, ls, t.(*Symbol))
case 4: case 4:
addaddrplus4(Ctxt, ls, t.(*LSym), 0) addaddrplus4(Ctxt, ls, t.(*Symbol), 0)
} }
r := &ls.R[len(ls.R)-1] r := &ls.R[len(ls.R)-1]
r.Type = obj.R_DWARFREF r.Type = obj.R_DWARFREF
...@@ -69,17 +69,17 @@ func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64 ...@@ -69,17 +69,17 @@ func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64
/* /*
* Offsets and sizes of the debug_* sections in the cout file. * Offsets and sizes of the debug_* sections in the cout file.
*/ */
var abbrevsym *LSym var abbrevsym *Symbol
var arangessec *LSym var arangessec *Symbol
var framesec *LSym var framesec *Symbol
var infosec *LSym var infosec *Symbol
var linesec *LSym var linesec *Symbol
var gdbscript string var gdbscript string
var dwarfp *LSym var dwarfp *Symbol
func writeabbrev(syms []*LSym) []*LSym { func writeabbrev(syms []*Symbol) []*Symbol {
s := Linklookup(Ctxt, ".debug_abbrev", 0) s := Linklookup(Ctxt, ".debug_abbrev", 0)
s.Type = obj.SDWARFSECT s.Type = obj.SDWARFSECT
abbrevsym = s abbrevsym = s
...@@ -170,7 +170,7 @@ func walktypedef(die *dwarf.DWDie) *dwarf.DWDie { ...@@ -170,7 +170,7 @@ func walktypedef(die *dwarf.DWDie) *dwarf.DWDie {
return die return die
} }
func walksymtypedef(s *LSym) *LSym { func walksymtypedef(s *Symbol) *Symbol {
if t := Linkrlookup(Ctxt, s.Name+"..def", int(s.Version)); t != nil { if t := Linkrlookup(Ctxt, s.Name+"..def", int(s.Version)); t != nil {
return t return t
} }
...@@ -195,7 +195,7 @@ func findchild(die *dwarf.DWDie, name string) *dwarf.DWDie { ...@@ -195,7 +195,7 @@ func findchild(die *dwarf.DWDie, name string) *dwarf.DWDie {
// Used to avoid string allocation when looking up dwarf symbols // Used to avoid string allocation when looking up dwarf symbols
var prefixBuf = []byte(dwarf.InfoPrefix) var prefixBuf = []byte(dwarf.InfoPrefix)
func find(name string) *LSym { func find(name string) *Symbol {
n := append(prefixBuf, name...) n := append(prefixBuf, name...)
// The string allocation below is optimized away because it is only used in a map lookup. // The string allocation below is optimized away because it is only used in a map lookup.
s := Linkrlookup(Ctxt, string(n), 0) s := Linkrlookup(Ctxt, string(n), 0)
...@@ -206,7 +206,7 @@ func find(name string) *LSym { ...@@ -206,7 +206,7 @@ func find(name string) *LSym {
return nil return nil
} }
func mustFind(name string) *LSym { func mustFind(name string) *Symbol {
r := find(name) r := find(name)
if r == nil { if r == nil {
Exitf("dwarf find: cannot find %s", name) Exitf("dwarf find: cannot find %s", name)
...@@ -214,7 +214,7 @@ func mustFind(name string) *LSym { ...@@ -214,7 +214,7 @@ func mustFind(name string) *LSym {
return r return r
} }
func adddwarfref(ctxt *Link, s *LSym, t *LSym, size int) int64 { func adddwarfref(ctxt *Link, s *Symbol, t *Symbol, size int) int64 {
var result int64 var result int64
switch size { switch size {
default: default:
...@@ -230,14 +230,14 @@ func adddwarfref(ctxt *Link, s *LSym, t *LSym, size int) int64 { ...@@ -230,14 +230,14 @@ func adddwarfref(ctxt *Link, s *LSym, t *LSym, size int) int64 {
return result return result
} }
func newrefattr(die *dwarf.DWDie, attr uint16, ref *LSym) *dwarf.DWAttr { func newrefattr(die *dwarf.DWDie, attr uint16, ref *Symbol) *dwarf.DWAttr {
if ref == nil { if ref == nil {
return nil return nil
} }
return newattr(die, attr, dwarf.DW_CLS_REFERENCE, 0, ref) return newattr(die, attr, dwarf.DW_CLS_REFERENCE, 0, ref)
} }
func putdies(ctxt dwarf.Context, syms []*LSym, die *dwarf.DWDie) []*LSym { func putdies(ctxt dwarf.Context, syms []*Symbol, die *dwarf.DWDie) []*Symbol {
for ; die != nil; die = die.Link { for ; die != nil; die = die.Link {
syms = putdie(ctxt, syms, die) syms = putdie(ctxt, syms, die)
} }
...@@ -246,14 +246,14 @@ func putdies(ctxt dwarf.Context, syms []*LSym, die *dwarf.DWDie) []*LSym { ...@@ -246,14 +246,14 @@ func putdies(ctxt dwarf.Context, syms []*LSym, die *dwarf.DWDie) []*LSym {
return syms return syms
} }
func dtolsym(s dwarf.Sym) *LSym { func dtolsym(s dwarf.Sym) *Symbol {
if s == nil { if s == nil {
return nil return nil
} }
return s.(*LSym) return s.(*Symbol)
} }
func putdie(ctxt dwarf.Context, syms []*LSym, die *dwarf.DWDie) []*LSym { func putdie(ctxt dwarf.Context, syms []*Symbol, die *dwarf.DWDie) []*Symbol {
s := dtolsym(die.Sym) s := dtolsym(die.Sym)
if s == nil { if s == nil {
s = syms[len(syms)-1] s = syms[len(syms)-1]
...@@ -303,13 +303,13 @@ func newmemberoffsetattr(die *dwarf.DWDie, offs int32) { ...@@ -303,13 +303,13 @@ func newmemberoffsetattr(die *dwarf.DWDie, offs int32) {
// GDB doesn't like FORM_addr for AT_location, so emit a // GDB doesn't like FORM_addr for AT_location, so emit a
// location expression that evals to a const. // location expression that evals to a const.
func newabslocexprattr(die *dwarf.DWDie, addr int64, sym *LSym) { func newabslocexprattr(die *dwarf.DWDie, addr int64, sym *Symbol) {
newattr(die, dwarf.DW_AT_location, dwarf.DW_CLS_ADDRESS, addr, sym) newattr(die, dwarf.DW_AT_location, dwarf.DW_CLS_ADDRESS, addr, sym)
// below // below
} }
// Lookup predefined types // Lookup predefined types
func lookup_or_diag(n string) *LSym { func lookup_or_diag(n string) *Symbol {
s := Linkrlookup(Ctxt, n, 0) s := Linkrlookup(Ctxt, n, 0)
if s == nil || s.Size == 0 { if s == nil || s.Size == 0 {
Exitf("dwarf: missing type: %s", n) Exitf("dwarf: missing type: %s", n)
...@@ -351,7 +351,7 @@ func dotypedef(parent *dwarf.DWDie, name string, def *dwarf.DWDie) { ...@@ -351,7 +351,7 @@ func dotypedef(parent *dwarf.DWDie, name string, def *dwarf.DWDie) {
} }
// Define gotype, for composite ones recurse into constituents. // Define gotype, for composite ones recurse into constituents.
func defgotype(gotype *LSym) *LSym { func defgotype(gotype *Symbol) *Symbol {
if gotype == nil { if gotype == nil {
return mustFind("<unspecified>") return mustFind("<unspecified>")
} }
...@@ -369,10 +369,10 @@ func defgotype(gotype *LSym) *LSym { ...@@ -369,10 +369,10 @@ func defgotype(gotype *LSym) *LSym {
return sdie return sdie
} }
return newtype(gotype).Sym.(*LSym) return newtype(gotype).Sym.(*Symbol)
} }
func newtype(gotype *LSym) *dwarf.DWDie { func newtype(gotype *Symbol) *dwarf.DWDie {
name := gotype.Name[5:] // could also decode from Type.string name := gotype.Name[5:] // could also decode from Type.string
kind := decodetype_kind(gotype) kind := decodetype_kind(gotype)
bytesize := decodetype_size(gotype) bytesize := decodetype_size(gotype)
...@@ -443,7 +443,7 @@ func newtype(gotype *LSym) *dwarf.DWDie { ...@@ -443,7 +443,7 @@ func newtype(gotype *LSym) *dwarf.DWDie {
newrefattr(die, dwarf.DW_AT_type, mustFind("void")) newrefattr(die, dwarf.DW_AT_type, mustFind("void"))
nfields := decodetype_funcincount(gotype) nfields := decodetype_funcincount(gotype)
var fld *dwarf.DWDie var fld *dwarf.DWDie
var s *LSym var s *Symbol
for i := 0; i < nfields; i++ { for i := 0; i < nfields; i++ {
s = decodetype_funcintype(gotype, i) s = decodetype_funcintype(gotype, i)
fld = newdie(die, dwarf.DW_ABRV_FUNCTYPEPARAM, s.Name[5:], 0) fld = newdie(die, dwarf.DW_ABRV_FUNCTYPEPARAM, s.Name[5:], 0)
...@@ -465,7 +465,7 @@ func newtype(gotype *LSym) *dwarf.DWDie { ...@@ -465,7 +465,7 @@ func newtype(gotype *LSym) *dwarf.DWDie {
dotypedef(&dwtypes, name, die) dotypedef(&dwtypes, name, die)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0) newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
nfields := int(decodetype_ifacemethodcount(gotype)) nfields := int(decodetype_ifacemethodcount(gotype))
var s *LSym var s *Symbol
if nfields == 0 { if nfields == 0 {
s = lookup_or_diag("type.runtime.eface") s = lookup_or_diag("type.runtime.eface")
} else { } else {
...@@ -508,7 +508,7 @@ func newtype(gotype *LSym) *dwarf.DWDie { ...@@ -508,7 +508,7 @@ func newtype(gotype *LSym) *dwarf.DWDie {
nfields := decodetype_structfieldcount(gotype) nfields := decodetype_structfieldcount(gotype)
var f string var f string
var fld *dwarf.DWDie var fld *dwarf.DWDie
var s *LSym var s *Symbol
for i := 0; i < nfields; i++ { for i := 0; i < nfields; i++ {
f = decodetype_structfieldname(gotype, i) f = decodetype_structfieldname(gotype, i)
s = decodetype_structfieldtype(gotype, i) s = decodetype_structfieldtype(gotype, i)
...@@ -538,12 +538,12 @@ func newtype(gotype *LSym) *dwarf.DWDie { ...@@ -538,12 +538,12 @@ func newtype(gotype *LSym) *dwarf.DWDie {
return die return die
} }
func nameFromDIESym(dwtype *LSym) string { func nameFromDIESym(dwtype *Symbol) string {
return strings.TrimSuffix(dwtype.Name[len(dwarf.InfoPrefix):], "..def") return strings.TrimSuffix(dwtype.Name[len(dwarf.InfoPrefix):], "..def")
} }
// Find or construct *T given T. // Find or construct *T given T.
func defptrto(dwtype *LSym) *LSym { func defptrto(dwtype *Symbol) *Symbol {
ptrname := "*" + nameFromDIESym(dwtype) ptrname := "*" + nameFromDIESym(dwtype)
die := find(ptrname) die := find(ptrname)
if die == nil { if die == nil {
...@@ -579,7 +579,7 @@ func copychildren(dst *dwarf.DWDie, src *dwarf.DWDie) { ...@@ -579,7 +579,7 @@ func copychildren(dst *dwarf.DWDie, src *dwarf.DWDie) {
// Search children (assumed to have TAG_member) for the one named // Search children (assumed to have TAG_member) for the one named
// field and set its AT_type to dwtype // field and set its AT_type to dwtype
func substitutetype(structdie *dwarf.DWDie, field string, dwtype *LSym) { func substitutetype(structdie *dwarf.DWDie, field string, dwtype *Symbol) {
child := findchild(structdie, field) child := findchild(structdie, field)
if child == nil { if child == nil {
Exitf("dwarf substitutetype: %s does not have member %s", Exitf("dwarf substitutetype: %s does not have member %s",
...@@ -629,7 +629,7 @@ func synthesizeslicetypes(die *dwarf.DWDie) { ...@@ -629,7 +629,7 @@ func synthesizeslicetypes(die *dwarf.DWDie) {
continue continue
} }
copychildren(die, prototype) copychildren(die, prototype)
elem := getattr(die, dwarf.DW_AT_go_elem).Data.(*LSym) elem := getattr(die, dwarf.DW_AT_go_elem).Data.(*Symbol)
substitutetype(die, "array", defptrto(elem)) substitutetype(die, "array", defptrto(elem))
} }
} }
...@@ -653,7 +653,7 @@ const ( ...@@ -653,7 +653,7 @@ const (
BucketSize = 8 BucketSize = 8
) )
func mkinternaltype(abbrev int, typename, keyname, valname string, f func(*dwarf.DWDie)) *LSym { func mkinternaltype(abbrev int, typename, keyname, valname string, f func(*dwarf.DWDie)) *Symbol {
name := mkinternaltypename(typename, keyname, valname) name := mkinternaltypename(typename, keyname, valname)
symname := dwarf.InfoPrefix + name symname := dwarf.InfoPrefix + name
s := Linkrlookup(Ctxt, symname, 0) s := Linkrlookup(Ctxt, symname, 0)
...@@ -677,7 +677,7 @@ func synthesizemaptypes(die *dwarf.DWDie) { ...@@ -677,7 +677,7 @@ func synthesizemaptypes(die *dwarf.DWDie) {
if die.Abbrev != dwarf.DW_ABRV_MAPTYPE { if die.Abbrev != dwarf.DW_ABRV_MAPTYPE {
continue continue
} }
gotype := getattr(die, dwarf.DW_AT_type).Data.(*LSym) gotype := getattr(die, dwarf.DW_AT_type).Data.(*Symbol)
keytype := decodetype_mapkey(gotype) keytype := decodetype_mapkey(gotype)
valtype := decodetype_mapvalue(gotype) valtype := decodetype_mapvalue(gotype)
keysize, valsize := decodetype_size(keytype), decodetype_size(valtype) keysize, valsize := decodetype_size(keytype), decodetype_size(valtype)
...@@ -773,7 +773,7 @@ func synthesizechantypes(die *dwarf.DWDie) { ...@@ -773,7 +773,7 @@ func synthesizechantypes(die *dwarf.DWDie) {
if die.Abbrev != dwarf.DW_ABRV_CHANTYPE { if die.Abbrev != dwarf.DW_ABRV_CHANTYPE {
continue continue
} }
elemgotype := getattr(die, dwarf.DW_AT_type).Data.(*LSym) elemgotype := getattr(die, dwarf.DW_AT_type).Data.(*Symbol)
elemsize := decodetype_size(elemgotype) elemsize := decodetype_size(elemgotype)
elemname := elemgotype.Name[5:] elemname := elemgotype.Name[5:]
elemtype := walksymtypedef(defgotype(elemgotype)) elemtype := walksymtypedef(defgotype(elemgotype))
...@@ -812,7 +812,7 @@ func synthesizechantypes(die *dwarf.DWDie) { ...@@ -812,7 +812,7 @@ func synthesizechantypes(die *dwarf.DWDie) {
} }
// For use with pass.c::genasmsym // For use with pass.c::genasmsym
func defdwsymb(sym *LSym, s string, t int, v int64, size int64, ver int, gotype *LSym) { func defdwsymb(sym *Symbol, s string, t int, v int64, size int64, ver int, gotype *Symbol) {
if strings.HasPrefix(s, "go.string.") { if strings.HasPrefix(s, "go.string.") {
return return
} }
...@@ -827,7 +827,7 @@ func defdwsymb(sym *LSym, s string, t int, v int64, size int64, ver int, gotype ...@@ -827,7 +827,7 @@ func defdwsymb(sym *LSym, s string, t int, v int64, size int64, ver int, gotype
var dv *dwarf.DWDie var dv *dwarf.DWDie
var dt *LSym var dt *Symbol
switch t { switch t {
default: default:
return return
...@@ -862,7 +862,7 @@ func movetomodule(parent *dwarf.DWDie) { ...@@ -862,7 +862,7 @@ func movetomodule(parent *dwarf.DWDie) {
} }
// If the pcln table contains runtime/runtime.go, use that to set gdbscript path. // If the pcln table contains runtime/runtime.go, use that to set gdbscript path.
func finddebugruntimepath(s *LSym) { func finddebugruntimepath(s *Symbol) {
if gdbscript != "" { if gdbscript != "" {
return return
} }
...@@ -886,7 +886,7 @@ const ( ...@@ -886,7 +886,7 @@ const (
OPCODE_BASE = 10 OPCODE_BASE = 10
) )
func putpclcdelta(ctxt dwarf.Context, s *LSym, delta_pc int64, delta_lc int64) { func putpclcdelta(ctxt dwarf.Context, s *Symbol, delta_pc int64, delta_lc int64) {
if LINE_BASE <= delta_lc && delta_lc < LINE_BASE+LINE_RANGE { if LINE_BASE <= delta_lc && delta_lc < LINE_BASE+LINE_RANGE {
var opcode int64 = OPCODE_BASE + (delta_lc - LINE_BASE) + (LINE_RANGE * delta_pc) var opcode int64 = OPCODE_BASE + (delta_lc - LINE_BASE) + (LINE_RANGE * delta_pc)
if OPCODE_BASE <= opcode && opcode < 256 { if OPCODE_BASE <= opcode && opcode < 256 {
...@@ -916,7 +916,7 @@ func getCompilationDir() string { ...@@ -916,7 +916,7 @@ func getCompilationDir() string {
return "/" return "/"
} }
func writelines(syms []*LSym) ([]*LSym, []*LSym) { func writelines(syms []*Symbol) ([]*Symbol, []*Symbol) {
var dwarfctxt dwarf.Context = dwCtxt{} var dwarfctxt dwarf.Context = dwCtxt{}
if linesec == nil { if linesec == nil {
linesec = Linklookup(Ctxt, ".debug_line", 0) linesec = Linklookup(Ctxt, ".debug_line", 0)
...@@ -926,13 +926,13 @@ func writelines(syms []*LSym) ([]*LSym, []*LSym) { ...@@ -926,13 +926,13 @@ func writelines(syms []*LSym) ([]*LSym, []*LSym) {
ls := linesec ls := linesec
syms = append(syms, ls) syms = append(syms, ls)
var funcs []*LSym var funcs []*Symbol
unitstart := int64(-1) unitstart := int64(-1)
headerstart := int64(-1) headerstart := int64(-1)
headerend := int64(-1) headerend := int64(-1)
epc := int64(0) epc := int64(0)
var epcs *LSym var epcs *Symbol
var dwinfo *dwarf.DWDie var dwinfo *dwarf.DWDie
lang := dwarf.DW_LANG_Go lang := dwarf.DW_LANG_Go
...@@ -1097,7 +1097,7 @@ func appendPCDeltaCFA(b []byte, deltapc, cfa int64) []byte { ...@@ -1097,7 +1097,7 @@ func appendPCDeltaCFA(b []byte, deltapc, cfa int64) []byte {
return b return b
} }
func writeframes(syms []*LSym) []*LSym { func writeframes(syms []*Symbol) []*Symbol {
var dwarfctxt dwarf.Context = dwCtxt{} var dwarfctxt dwarf.Context = dwCtxt{}
if framesec == nil { if framesec == nil {
framesec = Linklookup(Ctxt, ".debug_frame", 0) framesec = Linklookup(Ctxt, ".debug_frame", 0)
...@@ -1220,7 +1220,7 @@ const ( ...@@ -1220,7 +1220,7 @@ const (
COMPUNITHEADERSIZE = 4 + 2 + 4 + 1 COMPUNITHEADERSIZE = 4 + 2 + 4 + 1
) )
func writeinfo(syms []*LSym, funcs []*LSym) []*LSym { func writeinfo(syms []*Symbol, funcs []*Symbol) []*Symbol {
if infosec == nil { if infosec == nil {
infosec = Linklookup(Ctxt, ".debug_info", 0) infosec = Linklookup(Ctxt, ".debug_info", 0)
} }
...@@ -1253,7 +1253,7 @@ func writeinfo(syms []*LSym, funcs []*LSym) []*LSym { ...@@ -1253,7 +1253,7 @@ func writeinfo(syms []*LSym, funcs []*LSym) []*LSym {
dwarf.Uleb128put(dwarfctxt, s, int64(compunit.Abbrev)) dwarf.Uleb128put(dwarfctxt, s, int64(compunit.Abbrev))
dwarf.PutAttrs(dwarfctxt, s, compunit.Abbrev, compunit.Attr) dwarf.PutAttrs(dwarfctxt, s, compunit.Abbrev, compunit.Attr)
cu := []*LSym{s} cu := []*Symbol{s}
if funcs != nil { if funcs != nil {
cu = append(cu, funcs...) cu = append(cu, funcs...)
funcs = nil funcs = nil
...@@ -1289,7 +1289,7 @@ func ispubtype(die *dwarf.DWDie) bool { ...@@ -1289,7 +1289,7 @@ func ispubtype(die *dwarf.DWDie) bool {
return die.Abbrev >= dwarf.DW_ABRV_NULLTYPE return die.Abbrev >= dwarf.DW_ABRV_NULLTYPE
} }
func writepub(sname string, ispub func(*dwarf.DWDie) bool, syms []*LSym) []*LSym { func writepub(sname string, ispub func(*dwarf.DWDie) bool, syms []*Symbol) []*Symbol {
s := Linklookup(Ctxt, sname, 0) s := Linklookup(Ctxt, sname, 0)
s.Type = obj.SDWARFSECT s.Type = obj.SDWARFSECT
syms = append(syms, s) syms = append(syms, s)
...@@ -1329,7 +1329,7 @@ func writepub(sname string, ispub func(*dwarf.DWDie) bool, syms []*LSym) []*LSym ...@@ -1329,7 +1329,7 @@ func writepub(sname string, ispub func(*dwarf.DWDie) bool, syms []*LSym) []*LSym
* emit .debug_aranges. _info must have been written before, * emit .debug_aranges. _info must have been written before,
* because we need die->offs of dwarf.DW_globals. * because we need die->offs of dwarf.DW_globals.
*/ */
func writearanges(syms []*LSym) []*LSym { func writearanges(syms []*Symbol) []*Symbol {
s := Linklookup(Ctxt, ".debug_aranges", 0) s := Linklookup(Ctxt, ".debug_aranges", 0)
s.Type = obj.SDWARFSECT s.Type = obj.SDWARFSECT
// The first tuple is aligned to a multiple of the size of a single tuple // The first tuple is aligned to a multiple of the size of a single tuple
...@@ -1360,7 +1360,7 @@ func writearanges(syms []*LSym) []*LSym { ...@@ -1360,7 +1360,7 @@ func writearanges(syms []*LSym) []*LSym {
Adduint8(Ctxt, s, 0) Adduint8(Ctxt, s, 0)
} }
Addaddrplus(Ctxt, s, b.Data.(*LSym), b.Value-(b.Data.(*LSym)).Value) Addaddrplus(Ctxt, s, b.Data.(*Symbol), b.Value-(b.Data.(*Symbol)).Value)
adduintxx(Ctxt, s, uint64(e.Value-b.Value), SysArch.PtrSize) adduintxx(Ctxt, s, uint64(e.Value-b.Value), SysArch.PtrSize)
adduintxx(Ctxt, s, 0, SysArch.PtrSize) adduintxx(Ctxt, s, 0, SysArch.PtrSize)
adduintxx(Ctxt, s, 0, SysArch.PtrSize) adduintxx(Ctxt, s, 0, SysArch.PtrSize)
...@@ -1371,7 +1371,7 @@ func writearanges(syms []*LSym) []*LSym { ...@@ -1371,7 +1371,7 @@ func writearanges(syms []*LSym) []*LSym {
return syms return syms
} }
func writegdbscript(syms []*LSym) []*LSym { func writegdbscript(syms []*Symbol) []*Symbol {
if gdbscript != "" { if gdbscript != "" {
s := Linklookup(Ctxt, ".debug_gdb_scripts", 0) s := Linklookup(Ctxt, ".debug_gdb_scripts", 0)
...@@ -1484,7 +1484,7 @@ func dwarfgeneratedebugsyms() { ...@@ -1484,7 +1484,7 @@ func dwarfgeneratedebugsyms() {
/* /*
* Elf. * Elf.
*/ */
func dwarfaddshstrings(shstrtab *LSym) { func dwarfaddshstrings(shstrtab *Symbol) {
if Debug['w'] != 0 { // disable dwarf if Debug['w'] != 0 { // disable dwarf
return return
} }
......
...@@ -806,7 +806,7 @@ type ElfShdr struct { ...@@ -806,7 +806,7 @@ type ElfShdr struct {
addralign uint64 addralign uint64
entsize uint64 entsize uint64
shnum int shnum int
secsym *LSym secsym *Symbol
} }
/* /*
...@@ -1173,7 +1173,7 @@ func elfhash(name string) uint32 { ...@@ -1173,7 +1173,7 @@ func elfhash(name string) uint32 {
return h return h
} }
func Elfwritedynent(s *LSym, tag int, val uint64) { func Elfwritedynent(s *Symbol, tag int, val uint64) {
if elf64 { if elf64 {
Adduint64(Ctxt, s, uint64(tag)) Adduint64(Ctxt, s, uint64(tag))
Adduint64(Ctxt, s, val) Adduint64(Ctxt, s, val)
...@@ -1183,11 +1183,11 @@ func Elfwritedynent(s *LSym, tag int, val uint64) { ...@@ -1183,11 +1183,11 @@ func Elfwritedynent(s *LSym, tag int, val uint64) {
} }
} }
func elfwritedynentsym(s *LSym, tag int, t *LSym) { func elfwritedynentsym(s *Symbol, tag int, t *Symbol) {
Elfwritedynentsymplus(s, tag, t, 0) Elfwritedynentsymplus(s, tag, t, 0)
} }
func Elfwritedynentsymplus(s *LSym, tag int, t *LSym, add int64) { func Elfwritedynentsymplus(s *Symbol, tag int, t *Symbol, add int64) {
if elf64 { if elf64 {
Adduint64(Ctxt, s, uint64(tag)) Adduint64(Ctxt, s, uint64(tag))
} else { } else {
...@@ -1196,7 +1196,7 @@ func Elfwritedynentsymplus(s *LSym, tag int, t *LSym, add int64) { ...@@ -1196,7 +1196,7 @@ func Elfwritedynentsymplus(s *LSym, tag int, t *LSym, add int64) {
Addaddrplus(Ctxt, s, t, add) Addaddrplus(Ctxt, s, t, add)
} }
func elfwritedynentsymsize(s *LSym, tag int, t *LSym) { func elfwritedynentsymsize(s *Symbol, tag int, t *Symbol) {
if elf64 { if elf64 {
Adduint64(Ctxt, s, uint64(tag)) Adduint64(Ctxt, s, uint64(tag))
} else { } else {
...@@ -1719,7 +1719,7 @@ func elfshreloc(sect *Section) *ElfShdr { ...@@ -1719,7 +1719,7 @@ func elfshreloc(sect *Section) *ElfShdr {
return sh return sh
} }
func elfrelocsect(sect *Section, syms []*LSym) { func elfrelocsect(sect *Section, syms []*Symbol) {
// If main section is SHT_NOBITS, nothing to relocate. // If main section is SHT_NOBITS, nothing to relocate.
// Also nothing to relocate in .shstrtab. // Also nothing to relocate in .shstrtab.
if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen { if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen {
...@@ -2086,7 +2086,7 @@ func doelf() { ...@@ -2086,7 +2086,7 @@ func doelf() {
} }
// Do not write DT_NULL. elfdynhash will finish it. // Do not write DT_NULL. elfdynhash will finish it.
func shsym(sh *ElfShdr, s *LSym) { func shsym(sh *ElfShdr, s *Symbol) {
addr := Symaddr(s) addr := Symaddr(s)
if sh.flags&SHF_ALLOC != 0 { if sh.flags&SHF_ALLOC != 0 {
sh.addr = uint64(addr) sh.addr = uint64(addr)
...@@ -2604,7 +2604,7 @@ elfobj: ...@@ -2604,7 +2604,7 @@ elfobj:
} }
} }
func Elfadddynsym(ctxt *Link, s *LSym) { func Elfadddynsym(ctxt *Link, s *Symbol) {
if elf64 { if elf64 {
s.Dynid = int32(Nelfsym) s.Dynid = int32(Nelfsym)
Nelfsym++ Nelfsym++
......
...@@ -132,7 +132,7 @@ func loadcgo(file string, pkg string, p string) { ...@@ -132,7 +132,7 @@ func loadcgo(file string, pkg string, p string) {
var local string var local string
var remote string var remote string
var lib string var lib string
var s *LSym var s *Symbol
p0 := "" p0 := ""
for ; p != ""; p = next { for ; p != ""; p = next {
...@@ -315,7 +315,7 @@ func adddynlib(lib string) { ...@@ -315,7 +315,7 @@ func adddynlib(lib string) {
} }
} }
func Adddynsym(ctxt *Link, s *LSym) { func Adddynsym(ctxt *Link, s *Symbol) {
if s.Dynid >= 0 || Linkmode == LinkExternal { if s.Dynid >= 0 || Linkmode == LinkExternal {
return return
} }
......
...@@ -264,7 +264,7 @@ type ElfSect struct { ...@@ -264,7 +264,7 @@ type ElfSect struct {
align uint64 align uint64
entsize uint64 entsize uint64
base []byte base []byte
sym *LSym sym *Symbol
} }
type ElfObj struct { type ElfObj struct {
...@@ -303,12 +303,12 @@ type ElfSym struct { ...@@ -303,12 +303,12 @@ type ElfSym struct {
type_ uint8 type_ uint8
other uint8 other uint8
shndx uint16 shndx uint16
sym *LSym sym *Symbol
} }
var ElfMagic = [4]uint8{0x7F, 'E', 'L', 'F'} var ElfMagic = [4]uint8{0x7F, 'E', 'L', 'F'}
func valuecmp(a *LSym, b *LSym) int { func valuecmp(a *Symbol, b *Symbol) int {
if a.Value < b.Value { if a.Value < b.Value {
return -1 return -1
} }
...@@ -472,10 +472,10 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) { ...@@ -472,10 +472,10 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
var rela int var rela int
var rp *Reloc var rp *Reloc
var rsect *ElfSect var rsect *ElfSect
var s *LSym var s *Symbol
var sect *ElfSect var sect *ElfSect
var sym ElfSym var sym ElfSym
var symbols []*LSym var symbols []*Symbol
if _, err := io.ReadFull(f, hdrbuf[:]); err != nil { if _, err := io.ReadFull(f, hdrbuf[:]); err != nil {
goto bad goto bad
} }
...@@ -745,7 +745,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) { ...@@ -745,7 +745,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
// enter sub-symbols into symbol table. // enter sub-symbols into symbol table.
// symbol 0 is the null symbol. // symbol 0 is the null symbol.
symbols = make([]*LSym, elfobj.nsymtab) symbols = make([]*Symbol, elfobj.nsymtab)
for i := 1; i < elfobj.nsymtab; i++ { for i := 1; i < elfobj.nsymtab; i++ {
if err = readelfsym(elfobj, i, &sym, 1); err != nil { if err = readelfsym(elfobj, i, &sym, 1); err != nil {
...@@ -1022,7 +1022,7 @@ func readelfsym(elfobj *ElfObj, i int, sym *ElfSym, needSym int) (err error) { ...@@ -1022,7 +1022,7 @@ func readelfsym(elfobj *ElfObj, i int, sym *ElfSym, needSym int) (err error) {
sym.other = b.Other sym.other = b.Other
} }
var s *LSym var s *Symbol
if sym.name == "_GLOBAL_OFFSET_TABLE_" { if sym.name == "_GLOBAL_OFFSET_TABLE_" {
sym.name = ".got" sym.name = ".got"
} }
......
...@@ -92,7 +92,7 @@ type LdMachoSect struct { ...@@ -92,7 +92,7 @@ type LdMachoSect struct {
flags uint32 flags uint32
res1 uint32 res1 uint32
res2 uint32 res2 uint32
sym *LSym sym *Symbol
rel []LdMachoRel rel []LdMachoRel
} }
...@@ -123,7 +123,7 @@ type LdMachoSym struct { ...@@ -123,7 +123,7 @@ type LdMachoSym struct {
desc uint16 desc uint16
kind int8 kind int8
value uint64 value uint64
sym *LSym sym *Symbol
} }
type LdMachoDysymtab struct { type LdMachoDysymtab struct {
...@@ -433,9 +433,9 @@ func ldmacho(f *bio.Reader, pkg string, length int64, pn string) { ...@@ -433,9 +433,9 @@ func ldmacho(f *bio.Reader, pkg string, length int64, pn string) {
var sect *LdMachoSect var sect *LdMachoSect
var rel *LdMachoRel var rel *LdMachoRel
var rpi int var rpi int
var s *LSym var s *Symbol
var s1 *LSym var s1 *Symbol
var outer *LSym var outer *Symbol
var c *LdMachoCmd var c *LdMachoCmd
var symtab *LdMachoSymtab var symtab *LdMachoSymtab
var dsymtab *LdMachoDysymtab var dsymtab *LdMachoDysymtab
......
...@@ -107,14 +107,14 @@ type PeSym struct { ...@@ -107,14 +107,14 @@ type PeSym struct {
type_ uint16 type_ uint16
sclass uint8 sclass uint8
aux uint8 aux uint8
sym *LSym sym *Symbol
} }
type PeSect struct { type PeSect struct {
name string name string
base []byte base []byte
size uint64 size uint64
sym *LSym sym *Symbol
sh IMAGE_SECTION_HEADER sh IMAGE_SECTION_HEADER
} }
...@@ -153,7 +153,7 @@ func ldpe(f *bio.Reader, pkg string, length int64, pn string) { ...@@ -153,7 +153,7 @@ func ldpe(f *bio.Reader, pkg string, length int64, pn string) {
var r []Reloc var r []Reloc
var rp *Reloc var rp *Reloc
var rsect *PeSect var rsect *PeSect
var s *LSym var s *Symbol
var sym *PeSym var sym *PeSym
var symbuf [18]uint8 var symbuf [18]uint8
if err = binary.Read(f, binary.LittleEndian, &peobj.fh); err != nil { if err = binary.Read(f, binary.LittleEndian, &peobj.fh); err != nil {
...@@ -502,7 +502,7 @@ func readpesym(peobj *PeObj, i int, y **PeSym) (err error) { ...@@ -502,7 +502,7 @@ func readpesym(peobj *PeObj, i int, y **PeSym) (err error) {
name = name[:i] name = name[:i]
} }
var s *LSym var s *Symbol
switch sym.type_ { switch sym.type_ {
default: default:
err = fmt.Errorf("%s: invalid symbol type %d", sym.name, sym.type_) err = fmt.Errorf("%s: invalid symbol type %d", sym.name, sym.type_)
......
...@@ -95,10 +95,10 @@ type Arch struct { ...@@ -95,10 +95,10 @@ type Arch struct {
Openbsddynld string Openbsddynld string
Dragonflydynld string Dragonflydynld string
Solarisdynld string Solarisdynld string
Adddynrel func(*LSym, *Reloc) Adddynrel func(*Symbol, *Reloc)
Archinit func() Archinit func()
Archreloc func(*Reloc, *LSym, *int64) int Archreloc func(*Reloc, *Symbol, *int64) int
Archrelocvariant func(*Reloc, *LSym, int64) int64 Archrelocvariant func(*Reloc, *Symbol, int64) int64
Asmb func() Asmb func()
Elfreloc1 func(*Reloc, int64) int Elfreloc1 func(*Reloc, int64) int
Elfsetupplt func() Elfsetupplt func()
...@@ -189,7 +189,7 @@ func UseRelro() bool { ...@@ -189,7 +189,7 @@ func UseRelro() bool {
var ( var (
SysArch *sys.Arch SysArch *sys.Arch
outfile string outfile string
dynexp []*LSym dynexp []*Symbol
dynlib []string dynlib []string
ldflag []string ldflag []string
havedynamic int havedynamic int
...@@ -1541,7 +1541,7 @@ func ldshlibsyms(shlib string) { ...@@ -1541,7 +1541,7 @@ func ldshlibsyms(shlib string) {
Diag("cannot read symbols from shared library: %s", libpath) Diag("cannot read symbols from shared library: %s", libpath)
return return
} }
gcdata_locations := make(map[uint64]*LSym) gcdata_locations := make(map[uint64]*Symbol)
for _, elfsym := range syms { for _, elfsym := range syms {
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION { if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
continue continue
...@@ -1568,7 +1568,7 @@ func ldshlibsyms(shlib string) { ...@@ -1568,7 +1568,7 @@ func ldshlibsyms(shlib string) {
} }
} }
} }
gcdata_addresses := make(map[*LSym]uint64) gcdata_addresses := make(map[*Symbol]uint64)
if SysArch.Family == sys.ARM64 { if SysArch.Family == sys.ARM64 {
for _, sect := range f.Sections { for _, sect := range f.Sections {
if sect.Type == elf.SHT_RELA { if sect.Type == elf.SHT_RELA {
...@@ -1597,7 +1597,7 @@ func ldshlibsyms(shlib string) { ...@@ -1597,7 +1597,7 @@ func ldshlibsyms(shlib string) {
// We might have overwritten some functions above (this tends to happen for the // We might have overwritten some functions above (this tends to happen for the
// autogenerated type equality/hashing functions) and we don't want to generated // autogenerated type equality/hashing functions) and we don't want to generated
// pcln table entries for these any more so remove them from Textp. // pcln table entries for these any more so remove them from Textp.
textp := make([]*LSym, 0, len(Ctxt.Textp)) textp := make([]*Symbol, 0, len(Ctxt.Textp))
for _, s := range Ctxt.Textp { for _, s := range Ctxt.Textp {
if s.Type != obj.SDYNIMPORT { if s.Type != obj.SDYNIMPORT {
textp = append(textp, s) textp = append(textp, s)
...@@ -1678,12 +1678,12 @@ func Be32(b []byte) uint32 { ...@@ -1678,12 +1678,12 @@ func Be32(b []byte) uint32 {
} }
type Chain struct { type Chain struct {
sym *LSym sym *Symbol
up *Chain up *Chain
limit int // limit on entry to sym limit int // limit on entry to sym
} }
var morestack *LSym var morestack *Symbol
// TODO: Record enough information in new object files to // TODO: Record enough information in new object files to
// allow stack checks here. // allow stack checks here.
...@@ -1949,7 +1949,7 @@ func doversion() { ...@@ -1949,7 +1949,7 @@ func doversion() {
Exitf("version %s", obj.Getgoversion()) Exitf("version %s", obj.Getgoversion())
} }
func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) { func genasmsym(put func(*Symbol, string, int, int64, int64, int, *Symbol)) {
// These symbols won't show up in the first loop below because we // These symbols won't show up in the first loop below because we
// skip STEXT symbols. Normal STEXT symbols are emitted by walking textp. // skip STEXT symbols. Normal STEXT symbols are emitted by walking textp.
s := Linklookup(Ctxt, "runtime.text", 0) s := Linklookup(Ctxt, "runtime.text", 0)
...@@ -2079,7 +2079,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) { ...@@ -2079,7 +2079,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
Bso.Flush() Bso.Flush()
} }
func Symaddr(s *LSym) int64 { func Symaddr(s *Symbol) int64 {
if !s.Attr.Reachable() { if !s.Attr.Reachable() {
Diag("unreachable symbol in symaddr - %s", s.Name) Diag("unreachable symbol in symaddr - %s", s.Name)
} }
...@@ -2121,7 +2121,7 @@ func Entryvalue() int64 { ...@@ -2121,7 +2121,7 @@ func Entryvalue() int64 {
return s.Value return s.Value
} }
func undefsym(s *LSym) { func undefsym(s *Symbol) {
var r *Reloc var r *Reloc
Ctxt.Cursym = s Ctxt.Cursym = s
......
...@@ -37,7 +37,8 @@ import ( ...@@ -37,7 +37,8 @@ import (
"fmt" "fmt"
) )
type LSym struct { // Symbol is an entry in the symbol table.
type Symbol struct {
Name string Name string
Extname string Extname string
Type int16 Type int16
...@@ -56,28 +57,29 @@ type LSym struct { ...@@ -56,28 +57,29 @@ type LSym struct {
// is not set for symbols defined by the packages being linked or by symbols // is not set for symbols defined by the packages being linked or by symbols
// read by ldelf (and so is left as elf.STT_NOTYPE). // read by ldelf (and so is left as elf.STT_NOTYPE).
ElfType elf.SymType ElfType elf.SymType
Next *LSym Next *Symbol
Sub *LSym Sub *Symbol
Outer *LSym Outer *Symbol
Gotype *LSym Gotype *Symbol
Reachparent *LSym Reachparent *Symbol
File string File string
Dynimplib string Dynimplib string
Dynimpvers string Dynimpvers string
Sect *Section Sect *Section
FuncInfo *FuncInfo FuncInfo *FuncInfo
P []byte // P contains the raw symbol data.
R []Reloc P []byte
R []Reloc
} }
func (s *LSym) String() string { func (s *Symbol) String() string {
if s.Version == 0 { if s.Version == 0 {
return s.Name return s.Name
} }
return fmt.Sprintf("%s<%d>", s.Name, s.Version) return fmt.Sprintf("%s<%d>", s.Name, s.Version)
} }
func (s *LSym) ElfsymForReloc() int32 { func (s *Symbol) ElfsymForReloc() int32 {
// If putelfsym created a local version of this symbol, use that in all // If putelfsym created a local version of this symbol, use that in all
// relocations. // relocations.
if s.LocalElfsym != 0 { if s.LocalElfsym != 0 {
...@@ -138,13 +140,13 @@ type Reloc struct { ...@@ -138,13 +140,13 @@ type Reloc struct {
Variant int32 Variant int32
Add int64 Add int64
Xadd int64 Xadd int64
Sym *LSym Sym *Symbol
Xsym *LSym Xsym *Symbol
} }
type Auto struct { type Auto struct {
Asym *LSym Asym *Symbol
Gotype *LSym Gotype *Symbol
Aoffset int32 Aoffset int32
Name int16 Name int16
} }
...@@ -154,7 +156,7 @@ type Shlib struct { ...@@ -154,7 +156,7 @@ type Shlib struct {
Hash []byte Hash []byte
Deps []string Deps []string
File *elf.File File *elf.File
gcdata_addresses map[*LSym]uint64 gcdata_addresses map[*Symbol]uint64
} }
type Link struct { type Link struct {
...@@ -167,21 +169,21 @@ type Link struct { ...@@ -167,21 +169,21 @@ type Link struct {
Goroot string Goroot string
// Symbol lookup based on name and indexed by version. // Symbol lookup based on name and indexed by version.
Hash []map[string]*LSym Hash []map[string]*Symbol
Allsym []*LSym Allsym []*Symbol
Tlsg *LSym Tlsg *Symbol
Libdir []string Libdir []string
Library []*Library Library []*Library
Shlibs []Shlib Shlibs []Shlib
Tlsoffset int Tlsoffset int
Diag func(string, ...interface{}) Diag func(string, ...interface{})
Cursym *LSym Cursym *Symbol
Version int Version int
Textp []*LSym Textp []*Symbol
Filesyms []*LSym Filesyms []*Symbol
Moduledata *LSym Moduledata *Symbol
LSymBatch []LSym LSymBatch []Symbol
} }
// The smallest possible offset from the hardware stack pointer to a local // The smallest possible offset from the hardware stack pointer to a local
...@@ -203,7 +205,7 @@ func (ctxt *Link) FixedFrameSize() int64 { ...@@ -203,7 +205,7 @@ func (ctxt *Link) FixedFrameSize() int64 {
func (l *Link) IncVersion() { func (l *Link) IncVersion() {
l.Version++ l.Version++
l.Hash = append(l.Hash, make(map[string]*LSym)) l.Hash = append(l.Hash, make(map[string]*Symbol))
} }
type Library struct { type Library struct {
...@@ -223,9 +225,9 @@ type FuncInfo struct { ...@@ -223,9 +225,9 @@ type FuncInfo struct {
Pcfile Pcdata Pcfile Pcdata
Pcline Pcdata Pcline Pcdata
Pcdata []Pcdata Pcdata []Pcdata
Funcdata []*LSym Funcdata []*Symbol
Funcdataoff []int64 Funcdataoff []int64
File []*LSym File []*Symbol
} }
type Pcdata struct { type Pcdata struct {
......
...@@ -121,7 +121,7 @@ const ( ...@@ -121,7 +121,7 @@ const (
var nkind [NumSymKind]int var nkind [NumSymKind]int
var sortsym []*LSym var sortsym []*Symbol
var nsortsym int var nsortsym int
...@@ -602,7 +602,7 @@ func Asmbmacho() { ...@@ -602,7 +602,7 @@ func Asmbmacho() {
} }
} }
func symkind(s *LSym) int { func symkind(s *Symbol) int {
if s.Type == obj.SDYNIMPORT { if s.Type == obj.SDYNIMPORT {
return SymKindUndef return SymKindUndef
} }
...@@ -612,7 +612,7 @@ func symkind(s *LSym) int { ...@@ -612,7 +612,7 @@ func symkind(s *LSym) int {
return SymKindLocal return SymKindLocal
} }
func addsym(s *LSym, name string, type_ int, addr int64, size int64, ver int, gotype *LSym) { func addsym(s *Symbol, name string, type_ int, addr int64, size int64, ver int, gotype *Symbol) {
if s == nil { if s == nil {
return return
} }
...@@ -633,7 +633,7 @@ func addsym(s *LSym, name string, type_ int, addr int64, size int64, ver int, go ...@@ -633,7 +633,7 @@ func addsym(s *LSym, name string, type_ int, addr int64, size int64, ver int, go
nsortsym++ nsortsym++
} }
type machoscmp []*LSym type machoscmp []*Symbol
func (x machoscmp) Len() int { func (x machoscmp) Len() int {
return len(x) return len(x)
...@@ -656,7 +656,7 @@ func (x machoscmp) Less(i, j int) bool { ...@@ -656,7 +656,7 @@ func (x machoscmp) Less(i, j int) bool {
return s1.Extname < s2.Extname return s1.Extname < s2.Extname
} }
func machogenasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) { func machogenasmsym(put func(*Symbol, string, int, int64, int64, int, *Symbol)) {
genasmsym(put) genasmsym(put)
for _, s := range Ctxt.Allsym { for _, s := range Ctxt.Allsym {
if s.Type == obj.SDYNIMPORT || s.Type == obj.SHOSTOBJ { if s.Type == obj.SDYNIMPORT || s.Type == obj.SHOSTOBJ {
...@@ -675,7 +675,7 @@ func machosymorder() { ...@@ -675,7 +675,7 @@ func machosymorder() {
dynexp[i].Attr |= AttrReachable dynexp[i].Attr |= AttrReachable
} }
machogenasmsym(addsym) machogenasmsym(addsym)
sortsym = make([]*LSym, nsortsym) sortsym = make([]*Symbol, nsortsym)
nsortsym = 0 nsortsym = 0
machogenasmsym(addsym) machogenasmsym(addsym)
sort.Sort(machoscmp(sortsym[:nsortsym])) sort.Sort(machoscmp(sortsym[:nsortsym]))
...@@ -809,7 +809,7 @@ func Domacholink() int64 { ...@@ -809,7 +809,7 @@ func Domacholink() int64 {
return Rnd(int64(size), int64(INITRND)) return Rnd(int64(size), int64(INITRND))
} }
func machorelocsect(sect *Section, syms []*LSym) { func machorelocsect(sect *Section, syms []*Symbol) {
// If main section has no bits, nothing to relocate. // If main section has no bits, nothing to relocate.
if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen { if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen {
return return
......
...@@ -135,19 +135,19 @@ type objReader struct { ...@@ -135,19 +135,19 @@ type objReader struct {
pkg string pkg string
pn string pn string
// List of symbol references for the file being read. // List of symbol references for the file being read.
dupSym *LSym dupSym *Symbol
// rdBuf is used by readString and readSymName as scratch for reading strings. // rdBuf is used by readString and readSymName as scratch for reading strings.
rdBuf []byte rdBuf []byte
refs []*LSym refs []*Symbol
data []byte data []byte
reloc []Reloc reloc []Reloc
pcdata []Pcdata pcdata []Pcdata
autom []Auto autom []Auto
funcdata []*LSym funcdata []*Symbol
funcdataoff []int64 funcdataoff []int64
file []*LSym file []*Symbol
} }
func LoadObjFile(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) { func LoadObjFile(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
...@@ -157,7 +157,7 @@ func LoadObjFile(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) ...@@ -157,7 +157,7 @@ func LoadObjFile(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string)
pkg: pkg, pkg: pkg,
ctxt: ctxt, ctxt: ctxt,
pn: pn, pn: pn,
dupSym: &LSym{Name: ".dup"}, dupSym: &Symbol{Name: ".dup"},
} }
r.loadObjFile() r.loadObjFile()
if f.Offset() != start+length { if f.Offset() != start+length {
...@@ -192,7 +192,7 @@ func (r *objReader) loadObjFile() { ...@@ -192,7 +192,7 @@ func (r *objReader) loadObjFile() {
} }
// Symbol references // Symbol references
r.refs = []*LSym{nil} // zeroth ref is nil r.refs = []*Symbol{nil} // zeroth ref is nil
for { for {
c, err := r.rd.Peek(1) c, err := r.rd.Peek(1)
if err != nil { if err != nil {
...@@ -241,10 +241,10 @@ func (r *objReader) readSlices() { ...@@ -241,10 +241,10 @@ func (r *objReader) readSlices() {
n = r.readInt() n = r.readInt()
r.autom = make([]Auto, n) r.autom = make([]Auto, n)
n = r.readInt() n = r.readInt()
r.funcdata = make([]*LSym, n) r.funcdata = make([]*Symbol, n)
r.funcdataoff = make([]int64, n) r.funcdataoff = make([]int64, n)
n = r.readInt() n = r.readInt()
r.file = make([]*LSym, n) r.file = make([]*Symbol, n)
} }
// Symbols are prefixed so their content doesn't get confused with the magic footer. // Symbols are prefixed so their content doesn't get confused with the magic footer.
...@@ -265,7 +265,7 @@ func (r *objReader) readSym() { ...@@ -265,7 +265,7 @@ func (r *objReader) readSym() {
nreloc := r.readInt() nreloc := r.readInt()
isdup := false isdup := false
var dup *LSym var dup *Symbol
if s.Type != 0 && s.Type != obj.SXREF { if s.Type != 0 && s.Type != obj.SXREF {
if (t == obj.SDATA || t == obj.SBSS || t == obj.SNOPTRBSS) && len(data) == 0 && nreloc == 0 { if (t == obj.SDATA || t == obj.SBSS || t == obj.SNOPTRBSS) && len(data) == 0 && nreloc == 0 {
if s.Size < int64(size) { if s.Size < int64(size) {
...@@ -407,7 +407,7 @@ overwrite: ...@@ -407,7 +407,7 @@ overwrite:
} }
} }
func (r *objReader) patchDWARFName(s *LSym) { func (r *objReader) patchDWARFName(s *Symbol) {
// This is kind of ugly. Really the package name should not // This is kind of ugly. Really the package name should not
// even be included here. // even be included here.
if s.Size < 1 || s.P[0] != dwarf.DW_ABRV_FUNCTION { if s.Size < 1 || s.P[0] != dwarf.DW_ABRV_FUNCTION {
...@@ -618,7 +618,7 @@ func (r *objReader) readSymName() string { ...@@ -618,7 +618,7 @@ func (r *objReader) readSymName() string {
} }
// Reads the index of a symbol reference and resolves it to a symbol // Reads the index of a symbol reference and resolves it to a symbol
func (r *objReader) readSymIndex() *LSym { func (r *objReader) readSymIndex() *Symbol {
i := r.readInt() i := r.readInt()
return r.refs[i] return r.refs[i]
} }
...@@ -123,7 +123,7 @@ func addvarint(d *Pcdata, val uint32) { ...@@ -123,7 +123,7 @@ func addvarint(d *Pcdata, val uint32) {
p[0] = byte(v) p[0] = byte(v)
} }
func addpctab(ftab *LSym, off int32, d *Pcdata) int32 { func addpctab(ftab *Symbol, off int32, d *Pcdata) int32 {
var start int32 var start int32
if len(d.P) > 0 { if len(d.P) > 0 {
start = int32(len(ftab.P)) start = int32(len(ftab.P))
...@@ -132,7 +132,7 @@ func addpctab(ftab *LSym, off int32, d *Pcdata) int32 { ...@@ -132,7 +132,7 @@ func addpctab(ftab *LSym, off int32, d *Pcdata) int32 {
return int32(setuint32(Ctxt, ftab, int64(off), uint32(start))) return int32(setuint32(Ctxt, ftab, int64(off), uint32(start)))
} }
func ftabaddstring(ftab *LSym, s string) int32 { func ftabaddstring(ftab *Symbol, s string) int32 {
n := int32(len(s)) + 1 n := int32(len(s)) + 1
start := int32(len(ftab.P)) start := int32(len(ftab.P))
Symgrow(Ctxt, ftab, int64(start)+int64(n)+1) Symgrow(Ctxt, ftab, int64(start)+int64(n)+1)
...@@ -140,8 +140,8 @@ func ftabaddstring(ftab *LSym, s string) int32 { ...@@ -140,8 +140,8 @@ func ftabaddstring(ftab *LSym, s string) int32 {
return start return start
} }
func renumberfiles(ctxt *Link, files []*LSym, d *Pcdata) { func renumberfiles(ctxt *Link, files []*Symbol, d *Pcdata) {
var f *LSym var f *Symbol
// Give files numbers. // Give files numbers.
for i := 0; i < len(files); i++ { for i := 0; i < len(files); i++ {
...@@ -186,7 +186,7 @@ func renumberfiles(ctxt *Link, files []*LSym, d *Pcdata) { ...@@ -186,7 +186,7 @@ func renumberfiles(ctxt *Link, files []*LSym, d *Pcdata) {
*d = out *d = out
} }
func container(s *LSym) int { func container(s *Symbol) int {
// We want to generate func table entries only for the "lowest level" symbols, // We want to generate func table entries only for the "lowest level" symbols,
// not containers of subsymbols. // not containers of subsymbols.
if s != nil && s.Type&obj.SCONTAINER != 0 { if s != nil && s.Type&obj.SCONTAINER != 0 {
...@@ -204,8 +204,8 @@ var pclntab_zpcln FuncInfo ...@@ -204,8 +204,8 @@ var pclntab_zpcln FuncInfo
var pclntabNfunc int32 var pclntabNfunc int32
var pclntabFiletabOffset int32 var pclntabFiletabOffset int32
var pclntabPclntabOffset int32 var pclntabPclntabOffset int32
var pclntabFirstFunc *LSym var pclntabFirstFunc *Symbol
var pclntabLastFunc *LSym var pclntabLastFunc *Symbol
func pclntab() { func pclntab() {
funcdata_bytes := int64(0) funcdata_bytes := int64(0)
...@@ -243,7 +243,7 @@ func pclntab() { ...@@ -243,7 +243,7 @@ func pclntab() {
pclntabPclntabOffset = int32(8 + SysArch.PtrSize) pclntabPclntabOffset = int32(8 + SysArch.PtrSize)
nfunc = 0 nfunc = 0
var last *LSym var last *Symbol
for _, Ctxt.Cursym = range Ctxt.Textp { for _, Ctxt.Cursym = range Ctxt.Textp {
last = Ctxt.Cursym last = Ctxt.Cursym
if container(Ctxt.Cursym) != 0 { if container(Ctxt.Cursym) != 0 {
...@@ -420,7 +420,7 @@ func findfunctab() { ...@@ -420,7 +420,7 @@ func findfunctab() {
continue continue
} }
p := s.Value p := s.Value
var e *LSym var e *Symbol
i++ i++
if i < len(Ctxt.Textp) { if i < len(Ctxt.Textp) {
e = Ctxt.Textp[i] e = Ctxt.Textp[i]
......
...@@ -324,7 +324,7 @@ var dosstub = []uint8{ ...@@ -324,7 +324,7 @@ var dosstub = []uint8{
0x00, 0x00,
} }
var rsrcsym *LSym var rsrcsym *Symbol
var strtbl []byte var strtbl []byte
...@@ -357,7 +357,7 @@ var sh [16]IMAGE_SECTION_HEADER ...@@ -357,7 +357,7 @@ var sh [16]IMAGE_SECTION_HEADER
var dd []IMAGE_DATA_DIRECTORY var dd []IMAGE_DATA_DIRECTORY
type Imp struct { type Imp struct {
s *LSym s *Symbol
off uint64 off uint64
next *Imp next *Imp
argsize int argsize int
...@@ -373,7 +373,7 @@ type Dll struct { ...@@ -373,7 +373,7 @@ type Dll struct {
var dr *Dll var dr *Dll
var dexport [1024]*LSym var dexport [1024]*Symbol
var nexport int var nexport int
...@@ -674,7 +674,7 @@ func addimports(datsect *IMAGE_SECTION_HEADER) { ...@@ -674,7 +674,7 @@ func addimports(datsect *IMAGE_SECTION_HEADER) {
Cseek(endoff) Cseek(endoff)
} }
type byExtname []*LSym type byExtname []*Symbol
func (s byExtname) Len() int { return len(s) } func (s byExtname) Len() int { return len(s) }
func (s byExtname) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s byExtname) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
...@@ -764,7 +764,7 @@ func addexports() { ...@@ -764,7 +764,7 @@ func addexports() {
// perelocsect relocates symbols from first in section sect, and returns // perelocsect relocates symbols from first in section sect, and returns
// the total number of relocations emitted. // the total number of relocations emitted.
func perelocsect(sect *Section, syms []*LSym) int { func perelocsect(sect *Section, syms []*Symbol) int {
// If main section has no bits, nothing to relocate. // If main section has no bits, nothing to relocate.
if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen { if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen {
return 0 return 0
...@@ -931,7 +931,7 @@ func newPEDWARFSection(name string, size int64) *IMAGE_SECTION_HEADER { ...@@ -931,7 +931,7 @@ func newPEDWARFSection(name string, size int64) *IMAGE_SECTION_HEADER {
func writePESymTableRecords() int { func writePESymTableRecords() int {
var symcnt int var symcnt int
put := func(s *LSym, name string, type_ int, addr int64, size int64, ver int, gotype *LSym) { put := func(s *Symbol, name string, type_ int, addr int64, size int64, ver int, gotype *Symbol) {
if s == nil { if s == nil {
return return
} }
...@@ -1048,7 +1048,7 @@ func addpesymtable() { ...@@ -1048,7 +1048,7 @@ func addpesymtable() {
} }
} }
func setpersrc(sym *LSym) { func setpersrc(sym *Symbol) {
if rsrcsym != nil { if rsrcsym != nil {
Diag("too many .rsrc sections") Diag("too many .rsrc sections")
} }
......
...@@ -58,12 +58,12 @@ var headers = []struct { ...@@ -58,12 +58,12 @@ var headers = []struct {
func linknew(arch *sys.Arch) *Link { func linknew(arch *sys.Arch) *Link {
ctxt := &Link{ ctxt := &Link{
Hash: []map[string]*LSym{ Hash: []map[string]*Symbol{
// preallocate about 2mb for hash of // preallocate about 2mb for hash of
// non static symbols // non static symbols
make(map[string]*LSym, 100000), make(map[string]*Symbol, 100000),
}, },
Allsym: make([]*LSym, 0, 100000), Allsym: make([]*Symbol, 0, 100000),
Arch: arch, Arch: arch,
Goroot: obj.Getgoroot(), Goroot: obj.Getgoroot(),
} }
...@@ -160,10 +160,10 @@ func linknew(arch *sys.Arch) *Link { ...@@ -160,10 +160,10 @@ func linknew(arch *sys.Arch) *Link {
return ctxt return ctxt
} }
func linknewsym(ctxt *Link, name string, v int) *LSym { func linknewsym(ctxt *Link, name string, v int) *Symbol {
batch := ctxt.LSymBatch batch := ctxt.LSymBatch
if len(batch) == 0 { if len(batch) == 0 {
batch = make([]LSym, 1000) batch = make([]Symbol, 1000)
} }
s := &batch[0] s := &batch[0]
ctxt.LSymBatch = batch[1:] ctxt.LSymBatch = batch[1:]
...@@ -178,7 +178,7 @@ func linknewsym(ctxt *Link, name string, v int) *LSym { ...@@ -178,7 +178,7 @@ func linknewsym(ctxt *Link, name string, v int) *LSym {
return s return s
} }
func Linklookup(ctxt *Link, name string, v int) *LSym { func Linklookup(ctxt *Link, name string, v int) *Symbol {
m := ctxt.Hash[v] m := ctxt.Hash[v]
s := m[name] s := m[name]
if s != nil { if s != nil {
...@@ -191,7 +191,7 @@ func Linklookup(ctxt *Link, name string, v int) *LSym { ...@@ -191,7 +191,7 @@ func Linklookup(ctxt *Link, name string, v int) *LSym {
} }
// read-only lookup // read-only lookup
func Linkrlookup(ctxt *Link, name string, v int) *LSym { func Linkrlookup(ctxt *Link, name string, v int) *Symbol {
return ctxt.Hash[v][name] return ctxt.Hash[v][name]
} }
......
...@@ -84,7 +84,7 @@ var numelfsym int = 1 // 0 is reserved ...@@ -84,7 +84,7 @@ var numelfsym int = 1 // 0 is reserved
var elfbind int var elfbind int
func putelfsym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *LSym) { func putelfsym(x *Symbol, s string, t int, addr int64, size int64, ver int, go_ *Symbol) {
var type_ int var type_ int
switch t { switch t {
...@@ -184,7 +184,7 @@ func putelfsym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *L ...@@ -184,7 +184,7 @@ func putelfsym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *L
numelfsym++ numelfsym++
} }
func putelfsectionsym(s *LSym, shndx int) { func putelfsectionsym(s *Symbol, shndx int) {
putelfsyment(0, 0, 0, STB_LOCAL<<4|STT_SECTION, shndx, 0) putelfsyment(0, 0, 0, STB_LOCAL<<4|STT_SECTION, shndx, 0)
s.Elfsym = int32(numelfsym) s.Elfsym = int32(numelfsym)
numelfsym++ numelfsym++
...@@ -211,7 +211,7 @@ func Asmelfsym() { ...@@ -211,7 +211,7 @@ func Asmelfsym() {
genasmsym(putelfsym) genasmsym(putelfsym)
} }
func putplan9sym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *LSym) { func putplan9sym(x *Symbol, s string, t int, addr int64, size int64, ver int, go_ *Symbol) {
switch t { switch t {
case 'T', 'L', 'D', 'B': case 'T', 'L', 'D', 'B':
if ver != 0 { if ver != 0 {
...@@ -267,7 +267,7 @@ func Asmplan9sym() { ...@@ -267,7 +267,7 @@ func Asmplan9sym() {
genasmsym(putplan9sym) genasmsym(putplan9sym)
} }
var symt *LSym var symt *Symbol
var encbuf [10]byte var encbuf [10]byte
...@@ -360,8 +360,8 @@ func symtab() { ...@@ -360,8 +360,8 @@ func symtab() {
xdefine("runtime.egcbss", obj.SRODATA, 0) xdefine("runtime.egcbss", obj.SRODATA, 0)
// pseudo-symbols to mark locations of type, string, and go string data. // pseudo-symbols to mark locations of type, string, and go string data.
var symtype *LSym var symtype *Symbol
var symtyperel *LSym var symtyperel *Symbol
if UseRelro() && (Buildmode == BuildmodeCShared || Buildmode == BuildmodePIE) { if UseRelro() && (Buildmode == BuildmodeCShared || Buildmode == BuildmodePIE) {
s = Linklookup(Ctxt, "type.*", 0) s = Linklookup(Ctxt, "type.*", 0)
...@@ -386,7 +386,7 @@ func symtab() { ...@@ -386,7 +386,7 @@ func symtab() {
symtyperel = s symtyperel = s
} }
groupSym := func(name string, t int16) *LSym { groupSym := func(name string, t int16) *Symbol {
s := Linklookup(Ctxt, name, 0) s := Linklookup(Ctxt, name, 0)
s.Type = t s.Type = t
s.Size = 0 s.Size = 0
......
...@@ -40,7 +40,7 @@ import ( ...@@ -40,7 +40,7 @@ import (
func gentext() {} func gentext() {}
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
log.Fatalf("adddynrel not implemented") log.Fatalf("adddynrel not implemented")
} }
...@@ -101,7 +101,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { ...@@ -101,7 +101,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int {
return -1 return -1
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
switch r.Type { switch r.Type {
default: default:
...@@ -178,7 +178,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -178,7 +178,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
return -1 return -1
} }
......
...@@ -196,7 +196,7 @@ func gentext() { ...@@ -196,7 +196,7 @@ func gentext() {
// Construct a call stub in stub that calls symbol targ via its PLT // Construct a call stub in stub that calls symbol targ via its PLT
// entry. // entry.
func gencallstub(abicase int, stub *ld.LSym, targ *ld.LSym) { func gencallstub(abicase int, stub *ld.Symbol, targ *ld.Symbol) {
if abicase != 1 { if abicase != 1 {
// If we see R_PPC64_TOCSAVE or R_PPC64_REL24_NOTOC // If we see R_PPC64_TOCSAVE or R_PPC64_REL24_NOTOC
// relocations, we'll need to implement cases 2 and 3. // relocations, we'll need to implement cases 2 and 3.
...@@ -240,7 +240,7 @@ func gencallstub(abicase int, stub *ld.LSym, targ *ld.LSym) { ...@@ -240,7 +240,7 @@ func gencallstub(abicase int, stub *ld.LSym, targ *ld.LSym) {
ld.Adduint32(ld.Ctxt, stub, 0x4e800420) // bctr ld.Adduint32(ld.Ctxt, stub, 0x4e800420) // bctr
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym targ := r.Sym
ld.Ctxt.Cursym = s ld.Ctxt.Cursym = s
...@@ -448,8 +448,8 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { ...@@ -448,8 +448,8 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int {
} }
// Return the value of .TOC. for symbol s // Return the value of .TOC. for symbol s
func symtoc(s *ld.LSym) int64 { func symtoc(s *ld.Symbol) int64 {
var toc *ld.LSym var toc *ld.Symbol
if s.Outer != nil { if s.Outer != nil {
toc = ld.Linkrlookup(ld.Ctxt, ".TOC.", int(s.Outer.Version)) toc = ld.Linkrlookup(ld.Ctxt, ".TOC.", int(s.Outer.Version))
...@@ -465,7 +465,7 @@ func symtoc(s *ld.LSym) int64 { ...@@ -465,7 +465,7 @@ func symtoc(s *ld.LSym) int64 {
return toc.Value return toc.Value
} }
func archrelocaddr(r *ld.Reloc, s *ld.LSym, val *int64) int { func archrelocaddr(r *ld.Reloc, s *ld.Symbol, val *int64) int {
var o1, o2 uint32 var o1, o2 uint32
if ld.Ctxt.Arch.ByteOrder == binary.BigEndian { if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = uint32(*val >> 32) o1 = uint32(*val >> 32)
...@@ -514,7 +514,7 @@ func archrelocaddr(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -514,7 +514,7 @@ func archrelocaddr(r *ld.Reloc, s *ld.LSym, val *int64) int {
return 0 return 0
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
switch r.Type { switch r.Type {
default: default:
...@@ -607,7 +607,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -607,7 +607,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
switch r.Variant & ld.RV_TYPE_MASK { switch r.Variant & ld.RV_TYPE_MASK {
default: default:
ld.Diag("unexpected relocation variant %d", r.Variant) ld.Diag("unexpected relocation variant %d", r.Variant)
...@@ -698,7 +698,7 @@ overflow: ...@@ -698,7 +698,7 @@ overflow:
return t return t
} }
func addpltsym(ctxt *ld.Link, s *ld.LSym) { func addpltsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Plt >= 0 { if s.Plt >= 0 {
return return
} }
...@@ -744,7 +744,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) { ...@@ -744,7 +744,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) {
} }
// Generate the glink resolver stub if necessary and return the .glink section // Generate the glink resolver stub if necessary and return the .glink section
func ensureglinkresolver() *ld.LSym { func ensureglinkresolver() *ld.Symbol {
glink := ld.Linklookup(ld.Ctxt, ".glink", 0) glink := ld.Linklookup(ld.Ctxt, ".glink", 0)
if glink.Size != 0 { if glink.Size != 0 {
return glink return glink
......
...@@ -98,7 +98,7 @@ func gentext() { ...@@ -98,7 +98,7 @@ func gentext() {
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc) ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym targ := r.Sym
ld.Ctxt.Cursym = s ld.Ctxt.Cursym = s
...@@ -380,7 +380,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { ...@@ -380,7 +380,7 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int {
return -1 return -1
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
return -1 return -1
} }
...@@ -398,7 +398,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -398,7 +398,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
switch r.Variant & ld.RV_TYPE_MASK { switch r.Variant & ld.RV_TYPE_MASK {
default: default:
ld.Diag("unexpected relocation variant %d", r.Variant) ld.Diag("unexpected relocation variant %d", r.Variant)
...@@ -415,7 +415,7 @@ func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { ...@@ -415,7 +415,7 @@ func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 {
} }
} }
func addpltsym(ctxt *ld.Link, s *ld.LSym) { func addpltsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Plt >= 0 { if s.Plt >= 0 {
return return
} }
...@@ -478,7 +478,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) { ...@@ -478,7 +478,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) {
} }
} }
func addgotsym(s *ld.LSym) { func addgotsym(s *ld.Symbol) {
if s.Got >= 0 { if s.Got >= 0 {
return return
} }
......
...@@ -38,7 +38,7 @@ import ( ...@@ -38,7 +38,7 @@ import (
) )
// Append 4 bytes to s and create a R_CALL relocation targeting t to fill them in. // Append 4 bytes to s and create a R_CALL relocation targeting t to fill them in.
func addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) { func addcall(ctxt *ld.Link, s *ld.Symbol, t *ld.Symbol) {
s.Attr |= ld.AttrReachable s.Attr |= ld.AttrReachable
i := s.Size i := s.Size
s.Size += 4 s.Size += 4
...@@ -149,7 +149,7 @@ func gentext() { ...@@ -149,7 +149,7 @@ func gentext() {
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc) ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
} }
func adddynrel(s *ld.LSym, r *ld.Reloc) { func adddynrel(s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym targ := r.Sym
ld.Ctxt.Cursym = s ld.Ctxt.Cursym = s
...@@ -483,7 +483,7 @@ func pereloc1(r *ld.Reloc, sectoff int64) bool { ...@@ -483,7 +483,7 @@ func pereloc1(r *ld.Reloc, sectoff int64) bool {
return true return true
} }
func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { func archreloc(r *ld.Reloc, s *ld.Symbol, val *int64) int {
if ld.Linkmode == ld.LinkExternal { if ld.Linkmode == ld.LinkExternal {
return -1 return -1
} }
...@@ -500,7 +500,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { ...@@ -500,7 +500,7 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int {
return -1 return -1
} }
func archrelocvariant(r *ld.Reloc, s *ld.LSym, t int64) int64 { func archrelocvariant(r *ld.Reloc, s *ld.Symbol, t int64) int64 {
log.Fatalf("unexpected relocation variant") log.Fatalf("unexpected relocation variant")
return t return t
} }
...@@ -532,7 +532,7 @@ func elfsetupplt() { ...@@ -532,7 +532,7 @@ func elfsetupplt() {
} }
} }
func addpltsym(ctxt *ld.Link, s *ld.LSym) { func addpltsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Plt >= 0 { if s.Plt >= 0 {
return return
} }
...@@ -592,7 +592,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) { ...@@ -592,7 +592,7 @@ func addpltsym(ctxt *ld.Link, s *ld.LSym) {
} }
} }
func addgotsym(ctxt *ld.Link, s *ld.LSym) { func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
if s.Got >= 0 { if s.Got >= 0 {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment