mirror of
https://github.com/golang/go.git
synced 2025-05-21 15:24:21 +00:00
cmd: remove unused code
Generated with honnef.co/go/unused There is a large amount of unused code in cmd/internal/obj/s390x but that can wait til the s390x port is merged. There is some unused code in cmd/internal/unvendor/golang.org/x/arch/arm/armasm but that should be addressed upstream and a new revision imported. Change-Id: I252c0f9ea8c5bb1a0b530a374ef13a0a20ea56aa Reviewed-on: https://go-review.googlesource.com/21782 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
93368be61e
commit
bce9747ed0
@ -229,10 +229,7 @@ var (
|
|||||||
|
|
||||||
errCorruptArchive = errors.New("corrupt archive")
|
errCorruptArchive = errors.New("corrupt archive")
|
||||||
errTruncatedArchive = errors.New("truncated archive")
|
errTruncatedArchive = errors.New("truncated archive")
|
||||||
errNotArchive = errors.New("unrecognized archive format")
|
|
||||||
|
|
||||||
errCorruptObject = errors.New("corrupt object file")
|
errCorruptObject = errors.New("corrupt object file")
|
||||||
errTruncatedObject = errors.New("truncated object file")
|
|
||||||
errNotObject = errors.New("unrecognized object file format")
|
errNotObject = errors.New("unrecognized object file format")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -974,10 +974,6 @@ func OP_JMP(op uint32, i uint32) uint32 {
|
|||||||
return op | i&0x3FFFFFF
|
return op | i&0x3FFFFFF
|
||||||
}
|
}
|
||||||
|
|
||||||
func oclass(a *obj.Addr) int {
|
|
||||||
return int(a.Class) - 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
|
func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
|
||||||
o1 := uint32(0)
|
o1 := uint32(0)
|
||||||
o2 := uint32(0)
|
o2 := uint32(0)
|
||||||
|
@ -884,11 +884,6 @@ var yvex_vpbroadcast = []ytab{
|
|||||||
{Yxm, Ynone, Yyr, Zvex_rm_v_r, 2},
|
{Yxm, Ynone, Yyr, Zvex_rm_v_r, 2},
|
||||||
}
|
}
|
||||||
|
|
||||||
var yvex_xxmyxm = []ytab{
|
|
||||||
{Yxr, Ynone, Yxm, Zvex_r_v_rm, 2},
|
|
||||||
{Yyr, Ynone, Yxm, Zvex_r_v_rm, 2},
|
|
||||||
}
|
|
||||||
|
|
||||||
var ymmxmm0f38 = []ytab{
|
var ymmxmm0f38 = []ytab{
|
||||||
{Ymm, Ynone, Ymr, Zlitm_r, 3},
|
{Ymm, Ynone, Ymr, Zlitm_r, 3},
|
||||||
{Yxm, Ynone, Yxr, Zlitm_r, 5},
|
{Yxm, Ynone, Yxr, Zlitm_r, 5},
|
||||||
|
@ -76,7 +76,6 @@ func parseTestData(t *testing.T) *ParsedTestData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var spaces_re *regexp.Regexp = regexp.MustCompile("\\s+")
|
var spaces_re *regexp.Regexp = regexp.MustCompile("\\s+")
|
||||||
var marker_re *regexp.Regexp = regexp.MustCompile("MOVQ \\$([0-9]+), AX")
|
|
||||||
|
|
||||||
func normalize(s string) string {
|
func normalize(s string) string {
|
||||||
return spaces_re.ReplaceAllLiteralString(strings.TrimSpace(s), " ")
|
return spaces_re.ReplaceAllLiteralString(strings.TrimSpace(s), " ")
|
||||||
|
@ -69,8 +69,6 @@ func (f *peFile) symbols() ([]Sym, error) {
|
|||||||
text = 0x20
|
text = 0x20
|
||||||
data = 0x40
|
data = 0x40
|
||||||
bss = 0x80
|
bss = 0x80
|
||||||
permX = 0x20000000
|
|
||||||
permR = 0x40000000
|
|
||||||
permW = 0x80000000
|
permW = 0x80000000
|
||||||
)
|
)
|
||||||
ch := sect.Characteristics
|
ch := sect.Characteristics
|
||||||
|
@ -99,12 +99,6 @@ func gentext() {
|
|||||||
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func adddynrela(rela *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
ld.Addaddrplus(ld.Ctxt, rela, s, int64(r.Off))
|
|
||||||
ld.Adduint64(ld.Ctxt, rela, ld.R_X86_64_RELATIVE)
|
|
||||||
ld.Addaddrplus(ld.Ctxt, rela, r.Sym, r.Add) // Addend
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
targ := r.Sym
|
targ := r.Sym
|
||||||
ld.Ctxt.Cursym = s
|
ld.Ctxt.Cursym = s
|
||||||
|
@ -114,11 +114,6 @@ 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 adddynrela(rel *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
ld.Addaddrplus(ld.Ctxt, rel, s, int64(r.Off))
|
|
||||||
ld.Adduint32(ld.Ctxt, rel, ld.R_ARM_RELATIVE)
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
targ := r.Sym
|
targ := r.Sym
|
||||||
ld.Ctxt.Cursym = s
|
ld.Ctxt.Cursym = s
|
||||||
|
@ -91,10 +91,6 @@ func gentext() {
|
|||||||
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func adddynrela(rel *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
log.Fatalf("adddynrela not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
log.Fatalf("adddynrel not implemented")
|
log.Fatalf("adddynrel not implemented")
|
||||||
}
|
}
|
||||||
|
@ -236,10 +236,6 @@ func addaddrplus4(ctxt *Link, s *LSym, t *LSym, add int64) int64 {
|
|||||||
* Used for the data block.
|
* Used for the data block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func listnextp(s *LSym) **LSym {
|
|
||||||
return &s.Next
|
|
||||||
}
|
|
||||||
|
|
||||||
func listsubp(s *LSym) **LSym {
|
func listsubp(s *LSym) **LSym {
|
||||||
return &s.Sub
|
return &s.Sub
|
||||||
}
|
}
|
||||||
|
@ -170,9 +170,7 @@ type methodref struct {
|
|||||||
r [3]*Reloc // R_METHOD relocations to fields of runtime.method
|
r [3]*Reloc // R_METHOD relocations to fields of runtime.method
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m methodref) mtyp() *LSym { return m.r[0].Sym }
|
|
||||||
func (m methodref) ifn() *LSym { return m.r[1].Sym }
|
func (m methodref) ifn() *LSym { return m.r[1].Sym }
|
||||||
func (m methodref) tfn() *LSym { return m.r[2].Sym }
|
|
||||||
|
|
||||||
func (m methodref) isExported() bool {
|
func (m methodref) isExported() bool {
|
||||||
for _, r := range m.m {
|
for _, r := range m.m {
|
||||||
|
@ -56,11 +56,6 @@ func decodetype_kind(s *LSym) uint8 {
|
|||||||
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindMask) // 0x13 / 0x1f
|
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindMask) // 0x13 / 0x1f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type.commonType.kind
|
|
||||||
func decodetype_noptr(s *LSym) uint8 {
|
|
||||||
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindNoPointers) // 0x13 / 0x1f
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type.commonType.kind
|
// Type.commonType.kind
|
||||||
func decodetype_usegcprog(s *LSym) uint8 {
|
func decodetype_usegcprog(s *LSym) uint8 {
|
||||||
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindGCProg) // 0x13 / 0x1f
|
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindGCProg) // 0x13 / 0x1f
|
||||||
@ -216,19 +211,6 @@ func decodetype_structfieldarrayoff(s *LSym, i int) int {
|
|||||||
return off
|
return off
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodetype_stringptr(s *LSym, off int) string {
|
|
||||||
s = decode_reloc_sym(s, int32(off))
|
|
||||||
if s == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
r := decode_reloc(s, 0) // s has a pointer to the string data at offset 0
|
|
||||||
if r == nil { // shouldn't happen.
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
strlen := int64(decode_inuxi(s.P[SysArch.PtrSize:], SysArch.IntSize))
|
|
||||||
return string(r.Sym.P[r.Add : r.Add+strlen])
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 *LSym, off int) string {
|
||||||
r := decode_reloc(s, int32(off))
|
r := decode_reloc(s, int32(off))
|
||||||
|
@ -419,35 +419,7 @@ type Pkg struct {
|
|||||||
impby []*Pkg
|
impby []*Pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var pkgall []*Pkg
|
||||||
// pkgmap records the imported-by relationship between packages.
|
|
||||||
// Entries are keyed by package path (e.g., "runtime" or "net/url").
|
|
||||||
pkgmap = map[string]*Pkg{}
|
|
||||||
|
|
||||||
pkgall []*Pkg
|
|
||||||
)
|
|
||||||
|
|
||||||
func lookupPkg(path string) *Pkg {
|
|
||||||
if p, ok := pkgmap[path]; ok {
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
p := &Pkg{path: path}
|
|
||||||
pkgmap[path] = p
|
|
||||||
pkgall = append(pkgall, p)
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
// imported records that package pkg imports package imp.
|
|
||||||
func imported(pkg, imp string) {
|
|
||||||
// everyone imports runtime, even runtime.
|
|
||||||
if imp == "runtime" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
p := lookupPkg(pkg)
|
|
||||||
i := lookupPkg(imp)
|
|
||||||
i.impby = append(i.impby, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Pkg) cycle() *Pkg {
|
func (p *Pkg) cycle() *Pkg {
|
||||||
if p.checked {
|
if p.checked {
|
||||||
|
@ -586,11 +586,8 @@ func Asmbmacho() {
|
|||||||
// and we can assume OS X.
|
// and we can assume OS X.
|
||||||
//
|
//
|
||||||
// See golang.org/issues/12941.
|
// See golang.org/issues/12941.
|
||||||
const (
|
const LC_VERSION_MIN_MACOSX = 0x24
|
||||||
LC_VERSION_MIN_MACOSX = 0x24
|
|
||||||
LC_VERSION_MIN_IPHONEOS = 0x25
|
|
||||||
LC_VERSION_MIN_WATCHOS = 0x30
|
|
||||||
)
|
|
||||||
ml := newMachoLoad(LC_VERSION_MIN_MACOSX, 2)
|
ml := newMachoLoad(LC_VERSION_MIN_MACOSX, 2)
|
||||||
ml.data[0] = 10<<16 | 7<<8 | 0<<0 // OS X version 10.7.0
|
ml.data[0] = 10<<16 | 7<<8 | 0<<0 // OS X version 10.7.0
|
||||||
ml.data[1] = 10<<16 | 7<<8 | 0<<0 // SDK 10.7.0
|
ml.data[1] = 10<<16 | 7<<8 | 0<<0 // SDK 10.7.0
|
||||||
|
@ -15,11 +15,9 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fakedwarf, realdwarf, linkseg *macho.Segment
|
var realdwarf, linkseg *macho.Segment
|
||||||
var dwarfstart, linkstart int64
|
var dwarfstart, linkstart int64
|
||||||
var linkoffset uint32
|
var linkoffset uint32
|
||||||
var machHeader *macho.FileHeader
|
|
||||||
var mappedHeader []byte
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LC_ID_DYLIB = 0xd
|
LC_ID_DYLIB = 0xd
|
||||||
|
@ -41,10 +41,6 @@ import (
|
|||||||
|
|
||||||
func gentext() {}
|
func gentext() {}
|
||||||
|
|
||||||
func adddynrela(rel *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
log.Fatalf("adddynrela not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
log.Fatalf("adddynrel not implemented")
|
log.Fatalf("adddynrel not implemented")
|
||||||
}
|
}
|
||||||
|
@ -265,10 +265,6 @@ 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 adddynrela(rel *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
log.Fatalf("adddynrela not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
targ := r.Sym
|
targ := r.Sym
|
||||||
ld.Ctxt.Cursym = s
|
ld.Ctxt.Cursym = s
|
||||||
|
@ -139,10 +139,6 @@ func gentext() {
|
|||||||
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
ld.Addaddr(ld.Ctxt, initarray_entry, initfunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func adddynrela(rela *ld.LSym, s *ld.LSym, r *ld.Reloc) {
|
|
||||||
log.Fatalf("adddynrela not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
func adddynrel(s *ld.LSym, r *ld.Reloc) {
|
||||||
targ := r.Sym
|
targ := r.Sym
|
||||||
ld.Ctxt.Cursym = s
|
ld.Ctxt.Cursym = s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user