Commit ad49c7bb authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Ian Lance Taylor

cmd/internal/obj: remove dead fields and code

A quick pass through link.go, mostly removing fields that are not
used on the "creating a single object file" side of the fence.

Change-Id: I35ba41378c2c418f7df2f2f88dce65bc64a1a45d
Reviewed-on: https://go-review.googlesource.com/7672
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent e7d9f816
...@@ -1524,7 +1524,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) { ...@@ -1524,7 +1524,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
case 0: /* pseudo ops */ case 0: /* pseudo ops */
if false { /*debug['G']*/ if false { /*debug['G']*/
fmt.Printf("%x: %s: arm %d\n", uint32(p.Pc), p.From.Sym.Name, p.From.Sym.Fnptr) fmt.Printf("%x: %s: arm\n", uint32(p.Pc), p.From.Sym.Name)
} }
case 1: /* op R,[R],R */ case 1: /* op R,[R],R */
......
...@@ -115,7 +115,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) { ...@@ -115,7 +115,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SRODATA s.Type = obj.SRODATA
obj.Adduint32(ctxt, s, i32) obj.Adduint32(ctxt, s, i32)
s.Reachable = 0
} }
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
...@@ -132,7 +131,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) { ...@@ -132,7 +131,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SRODATA s.Type = obj.SRODATA
obj.Adduint64(ctxt, s, i64) obj.Adduint64(ctxt, s, i64)
s.Reachable = 0
} }
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
......
...@@ -121,7 +121,6 @@ func Setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 { ...@@ -121,7 +121,6 @@ func Setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
if s.Size < off+wid { if s.Size < off+wid {
s.Size = off + wid s.Size = off + wid
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
...@@ -183,7 +182,6 @@ func addaddrplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -183,7 +182,6 @@ func addaddrplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
i := s.Size i := s.Size
s.Size += int64(ctxt.Arch.Ptrsize) s.Size += int64(ctxt.Arch.Ptrsize)
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
...@@ -200,7 +198,6 @@ func addpcrelplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -200,7 +198,6 @@ func addpcrelplus(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
i := s.Size i := s.Size
s.Size += 4 s.Size += 4
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
...@@ -221,7 +218,6 @@ func setaddrplus(ctxt *Link, s *LSym, off int64, t *LSym, add int64) int64 { ...@@ -221,7 +218,6 @@ func setaddrplus(ctxt *Link, s *LSym, off int64, t *LSym, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
if off+int64(ctxt.Arch.Ptrsize) > s.Size { if off+int64(ctxt.Arch.Ptrsize) > s.Size {
s.Size = off + int64(ctxt.Arch.Ptrsize) s.Size = off + int64(ctxt.Arch.Ptrsize)
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
...@@ -244,7 +240,6 @@ func addsize(ctxt *Link, s *LSym, t *LSym) int64 { ...@@ -244,7 +240,6 @@ func addsize(ctxt *Link, s *LSym, t *LSym) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
i := s.Size i := s.Size
s.Size += int64(ctxt.Arch.Ptrsize) s.Size += int64(ctxt.Arch.Ptrsize)
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
...@@ -260,7 +255,6 @@ func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 { ...@@ -260,7 +255,6 @@ func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
if s.Type == 0 { if s.Type == 0 {
s.Type = SDATA s.Type = SDATA
} }
s.Reachable = 1
i := s.Size i := s.Size
s.Size += 4 s.Size += 4
Symgrow(ctxt, s, s.Size) Symgrow(ctxt, s, s.Size)
......
...@@ -271,52 +271,27 @@ const ( ...@@ -271,52 +271,27 @@ const (
) )
type LSym struct { type LSym struct {
Name string Name string
Extname string Type int16
Type int16 Version int16
Version int16 Dupok uint8
Dupok uint8 Cfunc uint8
Cfunc uint8 Nosplit uint8
External uint8 Leaf uint8
Nosplit uint8 Seenglobl uint8
Reachable uint8 Onlist uint8
Cgoexport uint8 Args int32
Special uint8 Locals int32
Stkcheck uint8 Value int64
Hide uint8 Size int64
Leaf uint8 Next *LSym
Fnptr uint8 Gotype *LSym
Localentry uint8 Autom *Auto
Seenglobl uint8 Text *Prog
Onlist uint8 Etext *Prog
Printed uint8 Pcln *Pcln
Symid int16 P []byte
Dynid int32 R []Reloc
Plt int32
Got int32
Align int32
Elfsym int32
Args int32
Locals int32
Value int64
Size int64
Allsym *LSym
Next *LSym
Sub *LSym
Outer *LSym
Gotype *LSym
Reachparent *LSym
Queue *LSym
File string
Dynimplib string
Dynimpvers string
Sect *struct{}
Autom *Auto
Text *Prog
Etext *Prog
Pcln *Pcln
P []byte
R []Reloc
} }
type Pcln struct { type Pcln struct {
...@@ -374,15 +349,13 @@ const ( ...@@ -374,15 +349,13 @@ const (
) )
type Reloc struct { type Reloc struct {
Off int32 Off int32
Siz uint8 Siz uint8
Done uint8 Type int32
Type int32 Add int64
Variant int32 Xadd int64
Add int64 Sym *LSym
Xadd int64 Xsym *LSym
Sym *LSym
Xsym *LSym
} }
// Reloc.type // Reloc.type
...@@ -408,17 +381,6 @@ const ( ...@@ -408,17 +381,6 @@ const (
R_POWER_TOC R_POWER_TOC
) )
// Reloc.variant
const (
RV_NONE = iota
RV_POWER_LO
RV_POWER_HI
RV_POWER_HA
RV_POWER_DS
RV_CHECK_OVERFLOW = 1 << 8
RV_TYPE_MASK = RV_CHECK_OVERFLOW - 1
)
type Auto struct { type Auto struct {
Asym *LSym Asym *LSym
Link *Auto Link *Auto
...@@ -438,7 +400,7 @@ type Pcdata struct { ...@@ -438,7 +400,7 @@ type Pcdata struct {
} }
// Pcdata iterator. // Pcdata iterator.
// for(pciterinit(ctxt, &it, &pcd); !it.done; pciternext(&it)) { it.value holds in [it.pc, it.nextpc) } // for(pciterinit(ctxt, &it, &pcd); !it.done; pciternext(&it)) { it.value holds in [it.pc, it.nextpc) }
type Pciter struct { type Pciter struct {
d Pcdata d Pcdata
p []byte p []byte
...@@ -459,24 +421,15 @@ const ( ...@@ -459,24 +421,15 @@ const (
// Link holds the context for writing object code from a compiler // Link holds the context for writing object code from a compiler
// to be linker input or for reading that input into the linker. // to be linker input or for reading that input into the linker.
type Link struct { type Link struct {
Thechar int32
Thestring string
Goarm int32 Goarm int32
Headtype int Headtype int
Arch *LinkArch Arch *LinkArch
Ignore func(string) int32
Debugasm int32 Debugasm int32
Debugline int32
Debughist int32
Debugread int32
Debugvlog int32 Debugvlog int32
Debugstack int32
Debugzerostack int32 Debugzerostack int32
Debugdivmod int32 Debugdivmod int32
Debugfloat int32
Debugpcln int32 Debugpcln int32
Flag_shared int32 Flag_shared int32
Iself int32
Bso *Biobuf Bso *Biobuf
Pathname string Pathname string
Windows int32 Windows int32
...@@ -485,8 +438,6 @@ type Link struct { ...@@ -485,8 +438,6 @@ type Link struct {
Goroot_final string Goroot_final string
Enforce_data_order int32 Enforce_data_order int32
Hash map[SymVer]*LSym Hash map[SymVer]*LSym
Allsym *LSym
Nsymbol int32
LineHist LineHist LineHist LineHist
Imports []string Imports []string
Plist *Plist Plist *Plist
...@@ -513,20 +464,13 @@ type Link struct { ...@@ -513,20 +464,13 @@ type Link struct {
Autosize int32 Autosize int32
Armsize int32 Armsize int32
Pc int64 Pc int64
Libdir []string
Library []Library
Tlsoffset int Tlsoffset int
Diag func(string, ...interface{}) Diag func(string, ...interface{})
Mode int Mode int
Curauto *Auto
Curhist *Auto
Cursym *LSym Cursym *LSym
Version int Version int
Textp *LSym Textp *LSym
Etextp *LSym Etextp *LSym
Histdepth int32
Nhistfile int32
Filesyms *LSym
} }
type SymVer struct { type SymVer struct {
...@@ -534,13 +478,6 @@ type SymVer struct { ...@@ -534,13 +478,6 @@ type SymVer struct {
Version int Version int
} }
type Library struct {
Objref string
Srcref string
File string
Pkg string
}
// LinkArch is the definition of a single architecture. // LinkArch is the definition of a single architecture.
type LinkArch struct { type LinkArch struct {
ByteOrder binary.ByteOrder ByteOrder binary.ByteOrder
...@@ -572,14 +509,6 @@ const ( ...@@ -572,14 +509,6 @@ const (
Hwindows Hwindows
) )
const (
LinkAuto = 0 + iota
LinkInternal
LinkExternal
)
var linkbasepointer int
type Plist struct { type Plist struct {
Name *LSym Name *LSym
Firstpc *Prog Firstpc *Prog
......
...@@ -225,18 +225,11 @@ func linknewsym(ctxt *Link, symb string, v int) *LSym { ...@@ -225,18 +225,11 @@ func linknewsym(ctxt *Link, symb string, v int) *LSym {
s := new(LSym) s := new(LSym)
*s = LSym{} *s = LSym{}
s.Dynid = -1
s.Plt = -1
s.Got = -1
s.Name = symb s.Name = symb
s.Type = 0 s.Type = 0
s.Version = int16(v) s.Version = int16(v)
s.Value = 0 s.Value = 0
s.Size = 0 s.Size = 0
ctxt.Nsymbol++
s.Allsym = ctxt.Allsym
ctxt.Allsym = s
return s return s
} }
...@@ -248,7 +241,6 @@ func _lookup(ctxt *Link, symb string, v int, creat int) *LSym { ...@@ -248,7 +241,6 @@ func _lookup(ctxt *Link, symb string, v int, creat int) *LSym {
} }
s = linknewsym(ctxt, symb, v) s = linknewsym(ctxt, symb, v)
s.Extname = s.Name
ctxt.Hash[SymVer{symb, v}] = s ctxt.Hash[SymVer{symb, v}] = s
return s return s
......
...@@ -246,7 +246,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) { ...@@ -246,7 +246,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SRODATA s.Type = obj.SRODATA
obj.Adduint32(ctxt, s, i32) obj.Adduint32(ctxt, s, i32)
s.Reachable = 0
} }
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
...@@ -290,7 +289,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) { ...@@ -290,7 +289,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
if s.Type == 0 { if s.Type == 0 {
s.Type = obj.SRODATA s.Type = obj.SRODATA
obj.Adduint64(ctxt, s, i64) obj.Adduint64(ctxt, s, i64)
s.Reachable = 0
} }
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
......
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