1
0
mirror of https://github.com/golang/go synced 2024-11-12 05:50:21 -07:00

cmd/internal/ld: remove some dead code

Just little bits and pieces I noticed were unused in passing, and
some more found with https://github.com/opennota/check.

Change-Id: I199fecdbf8dc2ff9076cf4ea81395275c7f171c3
Reviewed-on: https://go-review.googlesource.com/7033
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-03-07 16:28:07 +13:00 committed by Ian Lance Taylor
parent d6dfb0295b
commit 8c3cc58d0c
10 changed files with 65 additions and 186 deletions

View File

@ -694,12 +694,6 @@ const (
* marshal a 32-bit representation from the 64-bit structure.
*/
var numelfphdr int
var numelfshdr int
var elfstrsize int
var Elfstrdat []byte
/*

View File

@ -104,16 +104,6 @@ func addlibpath(ctxt *Link, srcref string, objref string, file string, pkg strin
l.Pkg = pkg
}
var fnuxi8 [8]uint8
var fnuxi4 [4]uint8
var inuxi1 [1]uint8
var inuxi2 [2]uint8
var inuxi8 [8]uint8
func atolwhex(s string) int64 {
n, _ := strconv.ParseInt(s, 0, 64)
return n

View File

@ -104,23 +104,15 @@ type Arch struct {
Vput func(uint64)
}
var Thearch Arch
var datap *LSym
var Debug [128]int
var literal string
var Lcsize int32
var rpath string
var Spsize int32
var symlist *LSym
var Symsize int32
var (
Thearch Arch
datap *LSym
Debug [128]int
Lcsize int32
rpath string
Spsize int32
Symsize int32
)
// Terrible but standard terminology.
// A segment describes a block of file to load into memory.
@ -155,65 +147,36 @@ type Section struct {
Rellen uint64
}
var Thestring string
var Thelinkarch *LinkArch
var outfile string
var ndynexp int
var dynexp []*LSym
var nldflag int
var ldflag []string
var havedynamic int
var Funcalign int
var iscgo bool
var elfglobalsymndx int
var flag_installsuffix string
var flag_race int
var Flag_shared int
var tracksym string
var interpreter string
var tmpdir string
var extld string
var extldflags string
var debug_s int // backup old value of debug['s']
var Ctxt *Link
var HEADR int32
var HEADTYPE int32
var INITRND int32
var INITTEXT int64
var INITDAT int64
var INITENTRY string /* entry point */
var nerrors int
var Linkmode int
var liveness int64
var (
Thestring string
Thelinkarch *LinkArch
outfile string
dynexp []*LSym
ldflag []string
havedynamic int
Funcalign int
iscgo bool
elfglobalsymndx int
flag_installsuffix string
flag_race int
Flag_shared int
tracksym string
interpreter string
tmpdir string
extld string
extldflags string
debug_s int // backup old value of debug['s']
Ctxt *Link
HEADR int32
HEADTYPE int32
INITRND int32
INITTEXT int64
INITDAT int64
INITENTRY string /* entry point */
nerrors int
Linkmode int
liveness int64
)
// for dynexport field of LSym
const (
@ -221,19 +184,12 @@ const (
CgoExportStatic = 1 << 1
)
var Segtext Segment
var Segrodata Segment
var Segdata Segment
var Segdwarf Segment
type Endian struct {
e16 func([]byte) uint16
e32 func([]byte) uint32
e64 func([]byte) uint64
}
var (
Segtext Segment
Segrodata Segment
Segdata Segment
Segdwarf Segment
)
/* set by call to mywhatsys() */
@ -244,13 +200,12 @@ const (
Pkgdef
)
var headstring string
// buffered output
var Bso Biobuf
var coutbuf Biobuf
var (
headstring string
// buffered output
Bso Biobuf
coutbuf Biobuf
)
const (
// Whether to assume that the external linker is "gold"
@ -263,21 +218,16 @@ const (
pkgname = "__.PKGDEF"
)
var cout *os.File
var version int
// Set if we see an object compiled by the host compiler that is not
// from a package that is known to support internal linking mode.
var externalobj = false
var goroot string
var goarch string
var goos string
var theline string
var (
cout *os.File
// Set if we see an object compiled by the host compiler that is not
// from a package that is known to support internal linking mode.
externalobj = false
goroot string
goarch string
goos string
theline string
)
func Lflag(arg string) {
Ctxt.Libdir = append(Ctxt.Libdir, arg)
@ -658,10 +608,6 @@ type Hostobj struct {
var hostobj []Hostobj
var nhostobj int
var mhostobj int
// These packages can use internal linking mode.
// Others trigger external mode.
var internalpkg = []string{
@ -1026,11 +972,6 @@ eof:
Diag("truncated object file: %s", pn)
}
func zerosig(sp string) {
s := Linklookup(Ctxt, sp, 0)
s.Sig = 0
}
func mywhatsys() {
goroot = obj.Getgoroot()
goos = obj.Getgoos()
@ -1041,18 +982,6 @@ func mywhatsys() {
}
}
func pathchar() int {
return '/'
}
var hunk []byte
var nhunk uint32
const (
NHUNK = 10 << 20
)
// Copied from ../gc/subr.c:/^pathtoprefix; must stay in sync.
/*
* Convert raw string to the prefix that will be used in the symbol table.
@ -1082,19 +1011,6 @@ func pathtoprefix(s string) string {
return s
}
func iconv(p string) string {
if p == "" {
var fp string
fp += "<nil>"
return fp
}
p = pathtoprefix(p)
var fp string
fp += p
return fp
}
func addsection(seg *Segment, name string, rwx int) *Section {
var l **Section
@ -1133,19 +1049,16 @@ func Be64(b []byte) uint64 {
return uint64(Be32(b))<<32 | uint64(Be32(b[4:]))
}
var be = Endian{Be16, Be32, Be64}
var le = Endian{Le16, Le32, Le64}
type Chain struct {
sym *LSym
up *Chain
limit int // limit on entry to sym
}
var morestack *LSym
var newstack *LSym
var (
morestack *LSym
newstack *LSym
)
// TODO: Record enough information in new object files to
// allow stack checks here.

View File

@ -50,7 +50,6 @@ type LSym struct {
Localentry uint8
Onlist uint8
Dynid int32
Sig int32
Plt int32
Got int32
Align int32
@ -128,7 +127,6 @@ type LinkArch struct {
ByteOrder binary.ByteOrder
Name string
Thechar int
Endian int32
Minlc int
Ptrsize int
Regsize int

View File

@ -95,10 +95,6 @@ var load []MachoLoad
var seg [16]MachoSeg
var nload int
var mload int
var nseg int
var ndebug int
@ -187,8 +183,6 @@ func newMachoSect(seg *MachoSeg, name string, segname string) *MachoSect {
var dylib []string
var ndylib int
var linkoff int64
func machowrite() int {

View File

@ -40,10 +40,6 @@ import (
// Reading object files.
const noname = "<none>"
var paramspace string = "FP"
func Ldmain() {
Ctxt = linknew(Thelinkarch)
Ctxt.Thechar = int32(Thearch.Thechar)
@ -189,7 +185,6 @@ func Ldmain() {
checkgo()
deadcode()
callgraph()
paramspace = "SP" /* (FP) now (SP) on output */
doelf()
if HEADTYPE == Hdarwin {

View File

@ -168,7 +168,6 @@ func linknewsym(ctxt *Link, symb string, v int) *LSym {
s.Type = 0
s.Version = int16(v)
s.Value = 0
s.Sig = 0
s.Size = 0
ctxt.Nsymbol++

View File

@ -34,8 +34,6 @@ import "strings"
// Symbol table.
var maxelfstr int
func putelfstr(s string) int {
if len(Elfstrdat) == 0 && s != "" {
// first entry must be empty string

View File

@ -106,7 +106,6 @@ type LSym struct {
Printed uint8
Symid int16
Dynid int32
Sig int32
Plt int32
Got int32
Align int32

View File

@ -231,7 +231,6 @@ func linknewsym(ctxt *Link, symb string, v int) *LSym {
s.Type = 0
s.Version = int16(v)
s.Value = 0
s.Sig = 0
s.Size = 0
ctxt.Nsymbol++