mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: replace Autom linked list with slice
Change-Id: I939129da0e71a7ccc61bec79515a34f0b1e59502 Reviewed-on: https://go-review.googlesource.com/20162 Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
1661493c73
commit
5be961a352
5 changed files with 12 additions and 15 deletions
|
|
@ -1589,7 +1589,7 @@ func writelines() {
|
||||||
dt, da int
|
dt, da int
|
||||||
offs int64
|
offs int64
|
||||||
)
|
)
|
||||||
for a := s.Autom; a != nil; a = a.Link {
|
for _, a := range s.Autom {
|
||||||
switch a.Name {
|
switch a.Name {
|
||||||
case obj.A_AUTO:
|
case obj.A_AUTO:
|
||||||
dt = DW_ABRV_AUTO
|
dt = DW_ABRV_AUTO
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ func markflood() {
|
||||||
if Debug['v'] > 1 {
|
if Debug['v'] > 1 {
|
||||||
fmt.Fprintf(&Bso, "marktext %s\n", s.Name)
|
fmt.Fprintf(&Bso, "marktext %s\n", s.Name)
|
||||||
}
|
}
|
||||||
for a := s.Autom; a != nil; a = a.Link {
|
for _, a := range s.Autom {
|
||||||
mark1(a.Gotype, s)
|
mark1(a.Gotype, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1964,7 +1964,6 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var a *Auto
|
|
||||||
var off int32
|
var off int32
|
||||||
for s := Ctxt.Textp; s != nil; s = s.Next {
|
for s := Ctxt.Textp; s != nil; s = s.Next {
|
||||||
put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), s.Gotype)
|
put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), s.Gotype)
|
||||||
|
|
@ -1972,7 +1971,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
|
||||||
// NOTE(ality): acid can't produce a stack trace without .frame symbols
|
// NOTE(ality): acid can't produce a stack trace without .frame symbols
|
||||||
put(nil, ".frame", 'm', int64(s.Locals)+int64(Thearch.Ptrsize), 0, 0, nil)
|
put(nil, ".frame", 'm', int64(s.Locals)+int64(Thearch.Ptrsize), 0, 0, nil)
|
||||||
|
|
||||||
for a = s.Autom; a != nil; a = a.Link {
|
for _, a := range s.Autom {
|
||||||
// Emit a or p according to actual offset, even if label is wrong.
|
// Emit a or p according to actual offset, even if label is wrong.
|
||||||
// This avoids negative offsets, which cannot be encoded.
|
// This avoids negative offsets, which cannot be encoded.
|
||||||
if a.Name != obj.A_AUTO && a.Name != obj.A_PARAM {
|
if a.Name != obj.A_AUTO && a.Name != obj.A_PARAM {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ type LSym struct {
|
||||||
Dynimplib string
|
Dynimplib string
|
||||||
Dynimpvers string
|
Dynimpvers string
|
||||||
Sect *Section
|
Sect *Section
|
||||||
Autom *Auto
|
Autom []Auto
|
||||||
Pcln *Pcln
|
Pcln *Pcln
|
||||||
P []byte
|
P []byte
|
||||||
R []Reloc
|
R []Reloc
|
||||||
|
|
@ -145,10 +145,9 @@ type Reloc struct {
|
||||||
|
|
||||||
type Auto struct {
|
type Auto struct {
|
||||||
Asym *LSym
|
Asym *LSym
|
||||||
Link *Auto
|
Gotype *LSym
|
||||||
Aoffset int32
|
Aoffset int32
|
||||||
Name int16
|
Name int16
|
||||||
Gotype *LSym
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Shlib struct {
|
type Shlib struct {
|
||||||
|
|
|
||||||
|
|
@ -266,15 +266,14 @@ overwrite:
|
||||||
}
|
}
|
||||||
rdint(f) // v&1 is Leaf, currently unused
|
rdint(f) // v&1 is Leaf, currently unused
|
||||||
n := rdint(f)
|
n := rdint(f)
|
||||||
var a *Auto
|
s.Autom = make([]Auto, n)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
a = new(Auto)
|
s.Autom[i] = Auto{
|
||||||
a.Asym = rdsym(ctxt, f, pkg)
|
Asym: rdsym(ctxt, f, pkg),
|
||||||
a.Aoffset = rdint32(f)
|
Aoffset: rdint32(f),
|
||||||
a.Name = rdint16(f)
|
Name: rdint16(f),
|
||||||
a.Gotype = rdsym(ctxt, f, pkg)
|
Gotype: rdsym(ctxt, f, pkg),
|
||||||
a.Link = s.Autom
|
}
|
||||||
s.Autom = a
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Pcln = new(Pcln)
|
s.Pcln = new(Pcln)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue