From: Dave Cheney Date: Tue, 15 Mar 2016 03:02:08 +0000 (+1100) Subject: cmd/internal/obj: remove dead code X-Git-Tag: go1.7beta1~1329 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=04f23b64287b14240b11cd1c14e14f19329d428f;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/internal/obj/flag.go b/src/cmd/internal/obj/flag.go index 998098e3fc..ff69fd9d57 100644 --- a/src/cmd/internal/obj/flag.go +++ b/src/cmd/internal/obj/flag.go @@ -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) diff --git a/src/cmd/internal/obj/pcln.go b/src/cmd/internal/obj/pcln.go index 577d80a1d6..3ed4ecfd8d 100644 --- a/src/cmd/internal/obj/pcln.go +++ b/src/cmd/internal/obj/pcln.go @@ -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) -} diff --git a/src/cmd/internal/obj/sym.go b/src/cmd/internal/obj/sym.go index d9935b3d51..5f856e0bf7 100644 --- a/src/cmd/internal/obj/sym.go +++ b/src/cmd/internal/obj/sym.go @@ -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 ""