Commit 04f23b64 authored by Dave Cheney's avatar Dave Cheney

cmd/internal/obj: remove dead code

Partial automatic cleanup driven by Dominik Honnef's unused tool.

As _lookup now only has one caller, merge it into the caller and remove
the conditional create logic.

Change-Id: I2ea354d9d4b32a19905271eca74725231b6d8a93
Reviewed-on: https://go-review.googlesource.com/20589
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 11a80860
......@@ -80,11 +80,6 @@ func (c *count) IsBoolFlag() bool {
type int32Value int32
func newIntValue(val int32, p *int32) *int32Value {
*p = val
return (*int32Value)(p)
}
func (i *int32Value) Set(s string) error {
v, err := strconv.ParseInt(s, 0, 64)
*i = int32Value(v)
......
......@@ -278,61 +278,3 @@ func linkpcln(ctxt *Link, cursym *LSym) {
}
}
}
// iteration over encoded pcdata tables.
func getvarint(pp *[]byte) uint32 {
v := uint32(0)
p := *pp
for shift := 0; ; shift += 7 {
v |= uint32(p[0]&0x7F) << uint(shift)
tmp7 := p
p = p[1:]
if tmp7[0]&0x80 == 0 {
break
}
}
*pp = p
return v
}
func pciternext(it *Pciter) {
it.pc = it.nextpc
if it.done != 0 {
return
}
if -cap(it.p) >= -cap(it.d.P[len(it.d.P):]) {
it.done = 1
return
}
// value delta
v := getvarint(&it.p)
if v == 0 && it.start == 0 {
it.done = 1
return
}
it.start = 0
dv := int32(v>>1) ^ (int32(v<<31) >> 31)
it.value += dv
// pc delta
v = getvarint(&it.p)
it.nextpc = it.pc + v*it.pcscale
}
func pciterinit(ctxt *Link, it *Pciter, d *Pcdata) {
it.d = *d
it.p = it.d.P
it.pc = 0
it.nextpc = 0
it.value = -1
it.start = 1
it.done = 0
it.pcscale = uint32(ctxt.Arch.Minlc)
pciternext(it)
}
......@@ -114,33 +114,23 @@ func Linknew(arch *LinkArch) *Link {
return ctxt
}
func _lookup(ctxt *Link, symb string, v int, create bool) *LSym {
s := ctxt.Hash[SymVer{symb, v}]
if s != nil || !create {
func Linklookup(ctxt *Link, name string, v int) *LSym {
s := ctxt.Hash[SymVer{name, v}]
if s != nil {
return s
}
s = &LSym{
Name: symb,
Name: name,
Type: 0,
Version: int16(v),
Value: 0,
Size: 0,
}
ctxt.Hash[SymVer{symb, v}] = s
ctxt.Hash[SymVer{name, v}] = s
return s
}
func Linklookup(ctxt *Link, name string, v int) *LSym {
return _lookup(ctxt, name, v, true)
}
// read-only lookup
func linkrlookup(ctxt *Link, name string, v int) *LSym {
return _lookup(ctxt, name, v, false)
}
func Linksymfmt(s *LSym) string {
if s == nil {
return "<nil>"
......
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