1
0
mirror of https://github.com/golang/go synced 2024-11-20 05:24:41 -07:00

cmd: remove unnecessary type conversions

CL generated mechanically with github.com/mdempsky/unconvert.

Change-Id: Ic590315cbc7026163a1b3f8ea306ba35f1a53256
Reviewed-on: https://go-review.googlesource.com/22103
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
Matthew Dempsky 2016-04-14 19:04:45 -07:00
parent e7b96e1a1f
commit 1441f76938
37 changed files with 108 additions and 108 deletions

View File

@ -59,7 +59,7 @@ func (p *Parser) append(prog *obj.Prog, cond string, doLabel bool) {
} }
p.pendingLabels = p.pendingLabels[0:0] p.pendingLabels = p.pendingLabels[0:0]
} }
prog.Pc = int64(p.pc) prog.Pc = p.pc
if *flags.Debug { if *flags.Debug {
fmt.Println(p.histLineNum, prog) fmt.Println(p.histLineNum, prog)
} }
@ -371,7 +371,7 @@ func (p *Parser) asmJump(op obj.As, cond string, a []obj.Addr) {
Offset: p.getConstant(prog, op, &a[0]), Offset: p.getConstant(prog, op, &a[0]),
} }
reg := int16(p.getConstant(prog, op, &a[1])) reg := int16(p.getConstant(prog, op, &a[1]))
reg, ok := p.arch.RegisterNumber("R", int16(reg)) reg, ok := p.arch.RegisterNumber("R", reg)
if !ok { if !ok {
p.errorf("bad register number %d", reg) p.errorf("bad register number %d", reg)
return return

View File

@ -73,7 +73,7 @@ func (f *File) ReadGo(name string) {
} }
for _, spec := range d.Specs { for _, spec := range d.Specs {
s, ok := spec.(*ast.ImportSpec) s, ok := spec.(*ast.ImportSpec)
if !ok || string(s.Path.Value) != `"C"` { if !ok || s.Path.Value != `"C"` {
continue continue
} }
sawC = true sawC = true
@ -106,7 +106,7 @@ func (f *File) ReadGo(name string) {
ws := 0 ws := 0
for _, spec := range d.Specs { for _, spec := range d.Specs {
s, ok := spec.(*ast.ImportSpec) s, ok := spec.(*ast.ImportSpec)
if !ok || string(s.Path.Value) != `"C"` { if !ok || s.Path.Value != `"C"` {
d.Specs[ws] = spec d.Specs[ws] = spec
ws++ ws++
} }
@ -147,7 +147,7 @@ func commentText(g *ast.CommentGroup) string {
} }
var pieces []string var pieces []string
for _, com := range g.List { for _, com := range g.List {
c := string(com.Text) c := com.Text
// Remove comment markers. // Remove comment markers.
// The parser has given us exactly the comment text. // The parser has given us exactly the comment text.
switch c[1] { switch c[1] {
@ -242,11 +242,11 @@ func (f *File) saveExport(x interface{}, context string) {
return return
} }
for _, c := range n.Doc.List { for _, c := range n.Doc.List {
if !strings.HasPrefix(string(c.Text), "//export ") { if !strings.HasPrefix(c.Text, "//export ") {
continue continue
} }
name := strings.TrimSpace(string(c.Text[9:])) name := strings.TrimSpace(c.Text[9:])
if name == "" { if name == "" {
error_(c.Pos(), "export missing name") error_(c.Pos(), "export missing name")
} }

View File

@ -135,7 +135,7 @@ func pushback(r0 *gc.Flow) {
} }
} }
t := obj.Prog(*r0.Prog) t := *r0.Prog
for r = gc.Uniqp(r0); ; r = gc.Uniqp(r) { for r = gc.Uniqp(r0); ; r = gc.Uniqp(r) {
p0 = r.Link.Prog p0 = r.Link.Prog
p := r.Prog p := r.Prog
@ -162,7 +162,7 @@ func pushback(r0 *gc.Flow) {
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 { if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
fmt.Printf("\tafter\n") fmt.Printf("\tafter\n")
for r := (*gc.Flow)(b); ; r = r.Link { for r := b; ; r = r.Link {
fmt.Printf("\t%v\n", r.Prog) fmt.Printf("\t%v\n", r.Prog)
if r == r0 { if r == r0 {
break break

View File

@ -30,7 +30,7 @@ var httpClient = http.DefaultClient
// when we're connecting to https servers that might not be there // when we're connecting to https servers that might not be there
// or might be using self-signed certificates. // or might be using self-signed certificates.
var impatientInsecureHTTPClient = &http.Client{ var impatientInsecureHTTPClient = &http.Client{
Timeout: time.Duration(5 * time.Second), Timeout: 5 * time.Second,
Transport: &http.Transport{ Transport: &http.Transport{
TLSClientConfig: &tls.Config{ TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, InsecureSkipVerify: true,

View File

@ -253,7 +253,7 @@ func bzrResolveRepo(vcsBzr *vcsCmd, rootDir, remoteRepo string) (realRepo string
return "", fmt.Errorf("unable to parse output of bzr info") return "", fmt.Errorf("unable to parse output of bzr info")
} }
out = out[:i] out = out[:i]
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(out), nil
} }
// vcsSvn describes how to use Subversion. // vcsSvn describes how to use Subversion.
@ -294,7 +294,7 @@ func svnRemoteRepo(vcsSvn *vcsCmd, rootDir string) (remoteRepo string, err error
return "", fmt.Errorf("unable to parse output of svn info") return "", fmt.Errorf("unable to parse output of svn info")
} }
out = out[:i] out = out[:i]
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(out), nil
} }
func (v *vcsCmd) String() string { func (v *vcsCmd) String() string {

View File

@ -250,7 +250,7 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
if p.From.Type == obj.TYPE_FCONST { if p.From.Type == obj.TYPE_FCONST {
f32 := float32(p.From.Val.(float64)) f32 := float32(p.From.Val.(float64))
i32 := math.Float32bits(f32) i32 := math.Float32bits(f32)
literal := fmt.Sprintf("$f32.%08x", uint32(i32)) literal := fmt.Sprintf("$f32.%08x", i32)
s := obj.Linklookup(ctxt, literal, 0) s := obj.Linklookup(ctxt, literal, 0)
s.Size = 4 s.Size = 4
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
@ -263,7 +263,7 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
case AFMOVD: case AFMOVD:
if p.From.Type == obj.TYPE_FCONST { if p.From.Type == obj.TYPE_FCONST {
i64 := math.Float64bits(p.From.Val.(float64)) i64 := math.Float64bits(p.From.Val.(float64))
literal := fmt.Sprintf("$f64.%016x", uint64(i64)) literal := fmt.Sprintf("$f64.%016x", i64)
s := obj.Linklookup(ctxt, literal, 0) s := obj.Linklookup(ctxt, literal, 0)
s.Size = 8 s.Size = 8
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM

View File

@ -183,7 +183,7 @@ func Setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 {
case 4: case 4:
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v)) ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v))
case 8: case 8:
ctxt.Arch.ByteOrder.PutUint64(s.P[off:], uint64(v)) ctxt.Arch.ByteOrder.PutUint64(s.P[off:], v)
} }
return off + wid return off + wid

View File

@ -1024,7 +1024,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
o1 = OP_IRR(opirr(ctxt, p.As), uint32(v), uint32(r), uint32(p.To.Reg)) o1 = OP_IRR(opirr(ctxt, p.As), uint32(v), uint32(r), uint32(p.To.Reg))
case 5: /* syscall */ case 5: /* syscall */
o1 = uint32(oprrr(ctxt, p.As)) o1 = oprrr(ctxt, p.As)
case 6: /* beq r1,[r2],sbra */ case 6: /* beq r1,[r2],sbra */
v := int32(0) v := int32(0)

View File

@ -371,9 +371,9 @@ func (w *objWriter) writeSymDebug(s *LSym) {
name = "TLS" name = "TLS"
} }
if ctxt.Arch.InFamily(sys.ARM, sys.PPC64) { if ctxt.Arch.InFamily(sys.ARM, sys.PPC64) {
fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%x\n", int(r.Off), r.Siz, r.Type, name, uint64(int64(r.Add))) fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%x\n", int(r.Off), r.Siz, r.Type, name, uint64(r.Add))
} else { } else {
fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%d\n", int(r.Off), r.Siz, r.Type, name, int64(r.Add)) fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%d\n", int(r.Off), r.Siz, r.Type, name, r.Add)
} }
} }
} }
@ -473,7 +473,7 @@ func (w *objWriter) writeSym(s *LSym) {
func (w *objWriter) writeInt(sval int64) { func (w *objWriter) writeInt(sval int64) {
var v uint64 var v uint64
uv := (uint64(sval) << 1) ^ uint64(int64(sval>>63)) uv := (uint64(sval) << 1) ^ uint64(sval>>63)
p := w.varintbuf[:] p := w.varintbuf[:]
for v = uv; v >= 0x80; v >>= 7 { for v = uv; v >= 0x80; v >>= 7 {
p[0] = uint8(v | 0x80) p[0] = uint8(v | 0x80)

View File

@ -64,7 +64,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(*
if val == oldval && started != 0 { if val == oldval && started != 0 {
val = valfunc(ctxt, func_, val, p, 1, arg) val = valfunc(ctxt, func_, val, p, 1, arg)
if ctxt.Debugpcln != 0 { if ctxt.Debugpcln != 0 {
fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(int64(p.Pc)), "", p) fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(p.Pc), "", p)
} }
continue continue
} }
@ -76,7 +76,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(*
if p.Link != nil && p.Link.Pc == p.Pc { if p.Link != nil && p.Link.Pc == p.Pc {
val = valfunc(ctxt, func_, val, p, 1, arg) val = valfunc(ctxt, func_, val, p, 1, arg)
if ctxt.Debugpcln != 0 { if ctxt.Debugpcln != 0 {
fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(int64(p.Pc)), "", p) fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(p.Pc), "", p)
} }
continue continue
} }
@ -96,7 +96,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(*
// where the 0x80 bit indicates that the integer continues. // where the 0x80 bit indicates that the integer continues.
if ctxt.Debugpcln != 0 { if ctxt.Debugpcln != 0 {
fmt.Fprintf(ctxt.Bso, "%6x %6d %v\n", uint64(int64(p.Pc)), val, p) fmt.Fprintf(ctxt.Bso, "%6x %6d %v\n", uint64(p.Pc), val, p)
} }
if started != 0 { if started != 0 {
@ -118,7 +118,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(*
if started != 0 { if started != 0 {
if ctxt.Debugpcln != 0 { if ctxt.Debugpcln != 0 {
fmt.Fprintf(ctxt.Bso, "%6x done\n", uint64(int64(func_.Text.Pc)+func_.Size)) fmt.Fprintf(ctxt.Bso, "%6x done\n", uint64(func_.Text.Pc+func_.Size))
} }
addvarint(ctxt, dst, uint32((func_.Size-pc)/int64(ctxt.Arch.MinLC))) addvarint(ctxt, dst, uint32((func_.Size-pc)/int64(ctxt.Arch.MinLC)))
addvarint(ctxt, dst, 0) // terminator addvarint(ctxt, dst, 0) // terminator
@ -164,7 +164,7 @@ func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg
if file == f { if file == f {
pcln.Lastfile = f pcln.Lastfile = f
pcln.Lastindex = int(i) pcln.Lastindex = int(i)
return int32(i) return i
} }
} }
pcln.File = append(pcln.File, f) pcln.File = append(pcln.File, f)

View File

@ -1384,7 +1384,7 @@ const (
// which relocation to use with a load or store and only supports the needed // which relocation to use with a load or store and only supports the needed
// instructions. // instructions.
func opform(ctxt *obj.Link, insn uint32) int { func opform(ctxt *obj.Link, insn uint32) int {
switch uint32(insn) { switch insn {
default: default:
ctxt.Diag("bad insn in loadform: %x", insn) ctxt.Diag("bad insn in loadform: %x", insn)
case OPVCC(58, 0, 0, 0), // ld case OPVCC(58, 0, 0, 0), // ld
@ -2198,9 +2198,9 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
} }
v := oprrr(ctxt, p.As) v := oprrr(ctxt, p.As)
t := v & (1<<10 | 1) /* OE|Rc */ t := v & (1<<10 | 1) /* OE|Rc */
o1 = AOP_RRR(uint32(v)&^uint32(t), REGTMP, uint32(r), uint32(p.From.Reg)) o1 = AOP_RRR(v&^t, REGTMP, uint32(r), uint32(p.From.Reg))
o2 = AOP_RRR(OP_MULLW, REGTMP, REGTMP, uint32(p.From.Reg)) o2 = AOP_RRR(OP_MULLW, REGTMP, REGTMP, uint32(p.From.Reg))
o3 = AOP_RRR(OP_SUBF|uint32(t), uint32(p.To.Reg), REGTMP, uint32(r)) o3 = AOP_RRR(OP_SUBF|t, uint32(p.To.Reg), REGTMP, uint32(r))
if p.As == AREMU { if p.As == AREMU {
o4 = o3 o4 = o3
@ -2216,9 +2216,9 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
} }
v := oprrr(ctxt, p.As) v := oprrr(ctxt, p.As)
t := v & (1<<10 | 1) /* OE|Rc */ t := v & (1<<10 | 1) /* OE|Rc */
o1 = AOP_RRR(uint32(v)&^uint32(t), REGTMP, uint32(r), uint32(p.From.Reg)) o1 = AOP_RRR(v&^t, REGTMP, uint32(r), uint32(p.From.Reg))
o2 = AOP_RRR(OP_MULLD, REGTMP, REGTMP, uint32(p.From.Reg)) o2 = AOP_RRR(OP_MULLD, REGTMP, REGTMP, uint32(p.From.Reg))
o3 = AOP_RRR(OP_SUBF|uint32(t), uint32(p.To.Reg), REGTMP, uint32(r)) o3 = AOP_RRR(OP_SUBF|t, uint32(p.To.Reg), REGTMP, uint32(r))
case 52: /* mtfsbNx cr(n) */ case 52: /* mtfsbNx cr(n) */
v := regoff(ctxt, &p.From) & 31 v := regoff(ctxt, &p.From) & 31
@ -2485,7 +2485,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
ctxt.Diag("invalid offset against tls var %v", p) ctxt.Diag("invalid offset against tls var %v", p)
} }
o1 = AOP_IRR(OP_ADDIS, uint32(p.To.Reg), REG_R2, 0) o1 = AOP_IRR(OP_ADDIS, uint32(p.To.Reg), REG_R2, 0)
o2 = AOP_IRR(uint32(opload(ctxt, AMOVD)), uint32(p.To.Reg), uint32(p.To.Reg), 0) o2 = AOP_IRR(opload(ctxt, AMOVD), uint32(p.To.Reg), uint32(p.To.Reg), 0)
rel := obj.Addrel(ctxt.Cursym) rel := obj.Addrel(ctxt.Cursym)
rel.Off = int32(ctxt.Pc) rel.Off = int32(ctxt.Pc)
rel.Siz = 8 rel.Siz = 8
@ -2499,7 +2499,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
} }
o1 = AOP_IRR(OP_ADDIS, uint32(p.To.Reg), REG_R2, 0) o1 = AOP_IRR(OP_ADDIS, uint32(p.To.Reg), REG_R2, 0)
o2 = AOP_IRR(uint32(opload(ctxt, AMOVD)), uint32(p.To.Reg), uint32(p.To.Reg), 0) o2 = AOP_IRR(opload(ctxt, AMOVD), uint32(p.To.Reg), uint32(p.To.Reg), 0)
rel := obj.Addrel(ctxt.Cursym) rel := obj.Addrel(ctxt.Cursym)
rel.Off = int32(ctxt.Pc) rel.Off = int32(ctxt.Pc)
rel.Siz = 8 rel.Siz = 8

View File

@ -279,7 +279,7 @@ func Dconv(p *Prog, a *Addr) string {
case TYPE_SHIFT: case TYPE_SHIFT:
v := int(a.Offset) v := int(a.Offset)
op := string("<<>>->@>"[((v>>5)&3)<<1:]) op := "<<>>->@>"[((v>>5)&3)<<1:]
if v&(1<<4) != 0 { if v&(1<<4) != 0 {
str = fmt.Sprintf("R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15) str = fmt.Sprintf("R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15)
} else { } else {

View File

@ -3308,7 +3308,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
case Pf2, /* xmm opcode escape */ case Pf2, /* xmm opcode escape */
Pf3: Pf3:
ctxt.AsmBuf.Put2(byte(o.prefix), Pm) ctxt.AsmBuf.Put2(o.prefix, Pm)
case Pef3: case Pef3:
ctxt.AsmBuf.Put3(Pe, Pf3, Pm) ctxt.AsmBuf.Put3(Pe, Pf3, Pm)
@ -3421,7 +3421,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
asmand(ctxt, p, &p.From, &p.To) asmand(ctxt, p, &p.From, &p.To)
case Zm2_r: case Zm2_r:
ctxt.AsmBuf.Put2(byte(op), byte(o.op[z+1])) ctxt.AsmBuf.Put2(byte(op), o.op[z+1])
asmand(ctxt, p, &p.From, &p.To) asmand(ctxt, p, &p.From, &p.To)
case Zm_r_xm: case Zm_r_xm:
@ -3531,7 +3531,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
} }
ctxt.AsmBuf.Put1(byte(op)) ctxt.AsmBuf.Put1(byte(op))
if p.As == AXABORT { if p.As == AXABORT {
ctxt.AsmBuf.Put1(byte(o.op[z+1])) ctxt.AsmBuf.Put1(o.op[z+1])
} }
ctxt.AsmBuf.Put1(byte(vaddr(ctxt, p, a, nil))) ctxt.AsmBuf.Put1(byte(vaddr(ctxt, p, a, nil)))
@ -3657,7 +3657,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
if yt.zcase == Zcallcon { if yt.zcase == Zcallcon {
ctxt.AsmBuf.Put1(byte(op)) ctxt.AsmBuf.Put1(byte(op))
} else { } else {
ctxt.AsmBuf.Put1(byte(o.op[z+1])) ctxt.AsmBuf.Put1(o.op[z+1])
} }
r = obj.Addrel(ctxt.Cursym) r = obj.Addrel(ctxt.Cursym)
r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len())) r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
@ -3667,7 +3667,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
ctxt.AsmBuf.PutInt32(0) ctxt.AsmBuf.PutInt32(0)
case Zcallind: case Zcallind:
ctxt.AsmBuf.Put2(byte(op), byte(o.op[z+1])) ctxt.AsmBuf.Put2(byte(op), o.op[z+1])
r = obj.Addrel(ctxt.Cursym) r = obj.Addrel(ctxt.Cursym)
r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len())) r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
r.Type = obj.R_ADDR r.Type = obj.R_ADDR
@ -3722,7 +3722,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
log.Fatalf("bad code") log.Fatalf("bad code")
} }
ctxt.AsmBuf.Put1(byte(o.op[z+1])) ctxt.AsmBuf.Put1(o.op[z+1])
r = obj.Addrel(ctxt.Cursym) r = obj.Addrel(ctxt.Cursym)
r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len())) r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
r.Sym = p.To.Sym r.Sym = p.To.Sym
@ -3762,7 +3762,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
v-- v--
} }
ctxt.AsmBuf.Put1(byte(o.op[z+1])) ctxt.AsmBuf.Put1(o.op[z+1])
ctxt.AsmBuf.PutInt32(int32(v)) ctxt.AsmBuf.PutInt32(int32(v))
} }
@ -3784,7 +3784,7 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
if yt.zcase == Zbr { if yt.zcase == Zbr {
ctxt.AsmBuf.Put1(0x0f) ctxt.AsmBuf.Put1(0x0f)
} }
ctxt.AsmBuf.Put1(byte(o.op[z+1])) ctxt.AsmBuf.Put1(o.op[z+1])
ctxt.AsmBuf.PutInt32(0) ctxt.AsmBuf.PutInt32(0)
} }

View File

@ -59,7 +59,7 @@ func (f *plan9File) symbols() ([]Sym, error) {
if !validSymType[s.Type] { if !validSymType[s.Type] {
continue continue
} }
sym := Sym{Addr: s.Value, Name: s.Name, Code: rune(s.Type)} sym := Sym{Addr: s.Value, Name: s.Name, Code: s.Type}
i := sort.Search(len(addrs), func(x int) bool { return addrs[x] > s.Value }) i := sort.Search(len(addrs), func(x int) bool { return addrs[x] > s.Value })
if i < len(addrs) { if i < len(addrs) {
sym.Size = int64(addrs[i] - s.Value) sym.Size = int64(addrs[i] - s.Value)

View File

@ -74,7 +74,7 @@ func parseGoCount(b []byte) (*Profile, error) {
if m == nil { if m == nil {
return nil, errUnrecognized return nil, errUnrecognized
} }
profileType := string(m[1]) profileType := m[1]
p := &Profile{ p := &Profile{
PeriodType: &ValueType{Type: profileType, Unit: "count"}, PeriodType: &ValueType{Type: profileType, Unit: "count"},
Period: 1, Period: 1,
@ -99,11 +99,11 @@ func parseGoCount(b []byte) (*Profile, error) {
if m == nil { if m == nil {
return nil, errMalformed return nil, errMalformed
} }
n, err := strconv.ParseInt(string(m[1]), 0, 64) n, err := strconv.ParseInt(m[1], 0, 64)
if err != nil { if err != nil {
return nil, errMalformed return nil, errMalformed
} }
fields := strings.Fields(string(m[2])) fields := strings.Fields(m[2])
locs := make([]*Location, 0, len(fields)) locs := make([]*Location, 0, len(fields))
for _, stk := range fields { for _, stk := range fields {
addr, err := strconv.ParseUint(stk, 0, 64) addr, err := strconv.ParseUint(stk, 0, 64)
@ -458,7 +458,7 @@ func parseCPUSamples(b []byte, parse func(b []byte) (uint64, []byte), adjust boo
} }
p.Sample = append(p.Sample, p.Sample = append(p.Sample,
&Sample{ &Sample{
Value: []int64{int64(count), int64(count) * int64(p.Period)}, Value: []int64{int64(count), int64(count) * p.Period},
Location: sloc, Location: sloc,
}) })
} }
@ -488,7 +488,7 @@ func parseHeap(b []byte) (p *Profile, err error) {
var period int64 var period int64
if len(header[6]) > 0 { if len(header[6]) > 0 {
if period, err = strconv.ParseInt(string(header[6]), 10, 64); err != nil { if period, err = strconv.ParseInt(header[6], 10, 64); err != nil {
return nil, errUnrecognized return nil, errUnrecognized
} }
} }

View File

@ -233,9 +233,9 @@ func decodeArg(aop instArg, x uint32) Arg {
typ, count := decodeShift(x) typ, count := decodeShift(x)
// ROR #0 here means ROR #0, but decodeShift rewrites to RRX #1. // ROR #0 here means ROR #0, but decodeShift rewrites to RRX #1.
if typ == RotateRightExt { if typ == RotateRightExt {
return Reg(Rm) return Rm
} }
return RegShift{Rm, typ, uint8(count)} return RegShift{Rm, typ, count}
case arg_R_shift_R: case arg_R_shift_R:
Rm := Reg(x & (1<<4 - 1)) Rm := Reg(x & (1<<4 - 1))
@ -247,9 +247,9 @@ func decodeArg(aop instArg, x uint32) Arg {
Rm := Reg(x & (1<<4 - 1)) Rm := Reg(x & (1<<4 - 1))
typ, count := decodeShift(x) typ, count := decodeShift(x)
if typ == ShiftLeft && count == 0 { if typ == ShiftLeft && count == 0 {
return Reg(Rm) return Rm
} }
return RegShift{Rm, typ, uint8(count)} return RegShift{Rm, typ, count}
case arg_R1_0: case arg_R1_0:
return Reg((x & (1<<4 - 1))) return Reg((x & (1<<4 - 1)))

View File

@ -1041,7 +1041,7 @@ Decode:
case xArgMoffs8, xArgMoffs16, xArgMoffs32, xArgMoffs64: case xArgMoffs8, xArgMoffs16, xArgMoffs32, xArgMoffs64:
// TODO(rsc): Can address be 64 bits? // TODO(rsc): Can address be 64 bits?
mem = Mem{Disp: int64(immc)} mem = Mem{Disp: immc}
if segIndex >= 0 { if segIndex >= 0 {
mem.Segment = prefixToSegment(inst.Prefix[segIndex]) mem.Segment = prefixToSegment(inst.Prefix[segIndex])
inst.Prefix[segIndex] |= PrefixImplicit inst.Prefix[segIndex] |= PrefixImplicit

View File

@ -735,7 +735,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()

View File

@ -649,7 +649,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()

View File

@ -488,7 +488,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()

View File

@ -80,7 +80,7 @@ func setuintxx(ctxt *Link, s *LSym, off int64, v uint64, wid int64) int64 {
case 4: case 4:
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v)) ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v))
case 8: case 8:
ctxt.Arch.ByteOrder.PutUint64(s.P[off:], uint64(v)) ctxt.Arch.ByteOrder.PutUint64(s.P[off:], v)
} }
return off + wid return off + wid
@ -757,7 +757,7 @@ func blk(start *LSym, addr int64, size int64) {
} }
Ctxt.Cursym = sym Ctxt.Cursym = sym
if sym.Value < addr { if sym.Value < addr {
Diag("phase error: addr=%#x but sym=%#x type=%d", int64(addr), int64(sym.Value), sym.Type) Diag("phase error: addr=%#x but sym=%#x type=%d", addr, sym.Value, sym.Type)
errorexit() errorexit()
} }
@ -773,7 +773,7 @@ func blk(start *LSym, addr int64, size int64) {
addr = sym.Value + sym.Size addr = sym.Value + sym.Size
} }
if addr != sym.Value+sym.Size { if addr != sym.Value+sym.Size {
Diag("phase error: addr=%#x value+size=%#x", int64(addr), int64(sym.Value)+sym.Size) Diag("phase error: addr=%#x value+size=%#x", addr, sym.Value+sym.Size)
errorexit() errorexit()
} }
@ -821,14 +821,14 @@ func Codeblk(addr int64, size int64) {
} }
if addr < sym.Value { if addr < sym.Value {
fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(int64(addr))) fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
for ; addr < sym.Value; addr++ { for ; addr < sym.Value; addr++ {
fmt.Fprintf(Bso, " %.2x", 0) fmt.Fprintf(Bso, " %.2x", 0)
} }
fmt.Fprintf(Bso, "\n") fmt.Fprintf(Bso, "\n")
} }
fmt.Fprintf(Bso, "%.6x\t%-20s\n", uint64(int64(addr)), sym.Name) fmt.Fprintf(Bso, "%.6x\t%-20s\n", uint64(addr), sym.Name)
q = sym.P q = sym.P
for len(q) >= 16 { for len(q) >= 16 {
@ -844,7 +844,7 @@ func Codeblk(addr int64, size int64) {
} }
if addr < eaddr { if addr < eaddr {
fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(int64(addr))) fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
for ; addr < eaddr; addr++ { for ; addr < eaddr; addr++ {
fmt.Fprintf(Bso, " %.2x", 0) fmt.Fprintf(Bso, " %.2x", 0)
} }
@ -892,7 +892,7 @@ func Datblk(addr int64, size int64) {
p = sym.P p = sym.P
ep = p[len(sym.P):] ep = p[len(sym.P):]
for -cap(p) < -cap(ep) { for -cap(p) < -cap(ep) {
if -cap(p) > -cap(sym.P) && int(-cap(p)+cap(sym.P))%16 == 0 { if -cap(p) > -cap(sym.P) && (-cap(p)+cap(sym.P))%16 == 0 {
fmt.Fprintf(Bso, "\n\t%.8x|", uint(addr+int64(-cap(p)+cap(sym.P)))) fmt.Fprintf(Bso, "\n\t%.8x|", uint(addr+int64(-cap(p)+cap(sym.P))))
} }
fmt.Fprintf(Bso, " %.2x", p[0]) fmt.Fprintf(Bso, " %.2x", p[0])
@ -924,7 +924,7 @@ func Datblk(addr int64, size int64) {
typ = "call" typ = "call"
} }
fmt.Fprintf(Bso, "\treloc %.8x/%d %s %s+%#x [%#x]\n", uint(sym.Value+int64(r.Off)), r.Siz, typ, rsname, int64(r.Add), int64(r.Sym.Value+r.Add)) fmt.Fprintf(Bso, "\treloc %.8x/%d %s %s+%#x [%#x]\n", uint(sym.Value+int64(r.Off)), r.Siz, typ, rsname, r.Add, r.Sym.Value+r.Add)
} }
} }
} }
@ -1279,7 +1279,7 @@ func dodata() {
for s := datap; s != nil; s = s.Next { for s := datap; s != nil; s = s.Next {
if int64(len(s.P)) > s.Size { if int64(len(s.P)) > s.Size {
Diag("%s: initialize bounds (%d < %d)", s.Name, int64(s.Size), len(s.P)) Diag("%s: initialize bounds (%d < %d)", s.Name, s.Size, len(s.P))
} }
} }

View File

@ -53,12 +53,12 @@ func uncommonSize() int { return 2 * SysArch.PtrSize } // runtime.uncommont
// Type.commonType.kind // Type.commonType.kind
func decodetype_kind(s *LSym) uint8 { func decodetype_kind(s *LSym) uint8 {
return uint8(s.P[2*SysArch.PtrSize+7] & obj.KindMask) // 0x13 / 0x1f return s.P[2*SysArch.PtrSize+7] & obj.KindMask // 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 s.P[2*SysArch.PtrSize+7] & obj.KindGCProg // 0x13 / 0x1f
} }
// Type.commonType.size // Type.commonType.size

View File

@ -615,7 +615,7 @@ func putattr(s *LSym, abbrev int, form int, cls int, value int64, data interface
Adduint8(Ctxt, s, uint8(value)) Adduint8(Ctxt, s, uint8(value))
p := data.([]byte) p := data.([]byte)
for i := 0; int64(i) < value; i++ { for i := 0; int64(i) < value; i++ {
Adduint8(Ctxt, s, uint8(p[i])) Adduint8(Ctxt, s, p[i])
} }
case DW_FORM_block2: // block case DW_FORM_block2: // block
@ -624,7 +624,7 @@ func putattr(s *LSym, abbrev int, form int, cls int, value int64, data interface
Adduint16(Ctxt, s, uint16(value)) Adduint16(Ctxt, s, uint16(value))
p := data.([]byte) p := data.([]byte)
for i := 0; int64(i) < value; i++ { for i := 0; int64(i) < value; i++ {
Adduint8(Ctxt, s, uint8(p[i])) Adduint8(Ctxt, s, p[i])
} }
case DW_FORM_block4: // block case DW_FORM_block4: // block
@ -633,7 +633,7 @@ func putattr(s *LSym, abbrev int, form int, cls int, value int64, data interface
Adduint32(Ctxt, s, uint32(value)) Adduint32(Ctxt, s, uint32(value))
p := data.([]byte) p := data.([]byte)
for i := 0; int64(i) < value; i++ { for i := 0; int64(i) < value; i++ {
Adduint8(Ctxt, s, uint8(p[i])) Adduint8(Ctxt, s, p[i])
} }
case DW_FORM_block: // block case DW_FORM_block: // block
@ -641,7 +641,7 @@ func putattr(s *LSym, abbrev int, form int, cls int, value int64, data interface
p := data.([]byte) p := data.([]byte)
for i := 0; int64(i) < value; i++ { for i := 0; int64(i) < value; i++ {
Adduint8(Ctxt, s, uint8(p[i])) Adduint8(Ctxt, s, p[i])
} }
case DW_FORM_data1: // constant case DW_FORM_data1: // constant
@ -1179,7 +1179,7 @@ func synthesizemaptypes(die *DWDie) {
// Construct type to represent an array of BucketSize keys // Construct type to represent an array of BucketSize keys
keyname := nameFromDIESym(keytype) keyname := nameFromDIESym(keytype)
dwhks := mkinternaltype(DW_ABRV_ARRAYTYPE, "[]key", keyname, "", func(dwhk *DWDie) { dwhks := mkinternaltype(DW_ABRV_ARRAYTYPE, "[]key", keyname, "", func(dwhk *DWDie) {
newattr(dwhk, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize*int64(keysize), 0) newattr(dwhk, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize*keysize, 0)
t := keytype t := keytype
if indirect_key { if indirect_key {
t = defptrto(keytype) t = defptrto(keytype)
@ -1193,7 +1193,7 @@ func synthesizemaptypes(die *DWDie) {
// Construct type to represent an array of BucketSize values // Construct type to represent an array of BucketSize values
valname := nameFromDIESym(valtype) valname := nameFromDIESym(valtype)
dwhvs := mkinternaltype(DW_ABRV_ARRAYTYPE, "[]val", valname, "", func(dwhv *DWDie) { dwhvs := mkinternaltype(DW_ABRV_ARRAYTYPE, "[]val", valname, "", func(dwhv *DWDie) {
newattr(dwhv, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize*int64(valsize), 0) newattr(dwhv, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize*valsize, 0)
t := valtype t := valtype
if indirect_val { if indirect_val {
t = defptrto(valtype) t = defptrto(valtype)
@ -1225,7 +1225,7 @@ func synthesizemaptypes(die *DWDie) {
newmemberoffsetattr(fld, BucketSize+BucketSize*(int32(keysize)+int32(valsize))+int32(SysArch.PtrSize)) newmemberoffsetattr(fld, BucketSize+BucketSize*(int32(keysize)+int32(valsize))+int32(SysArch.PtrSize))
} }
newattr(dwhb, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize+BucketSize*int64(keysize)+BucketSize*int64(valsize)+int64(SysArch.RegSize), 0) newattr(dwhb, DW_AT_byte_size, DW_CLS_CONSTANT, BucketSize+BucketSize*keysize+BucketSize*valsize+int64(SysArch.RegSize), 0)
}) })
// Construct hash<K,V> // Construct hash<K,V>
@ -1269,7 +1269,7 @@ func synthesizechantypes(die *DWDie) {
} else { } else {
elemsize = 0 elemsize = 0
} }
newattr(dws, DW_AT_byte_size, DW_CLS_CONSTANT, int64(sudogsize)+int64(elemsize), nil) newattr(dws, DW_AT_byte_size, DW_CLS_CONSTANT, int64(sudogsize)+elemsize, nil)
}) })
// waitq<T> // waitq<T>
@ -1787,7 +1787,7 @@ func writeinfo(prev *LSym) *LSym {
} }
setuint32(Ctxt, s, 0, uint32(cusize)) setuint32(Ctxt, s, 0, uint32(cusize))
newattr(compunit, DW_AT_byte_size, DW_CLS_CONSTANT, int64(cusize), 0) newattr(compunit, DW_AT_byte_size, DW_CLS_CONSTANT, cusize, 0)
} }
return prev return prev
} }

View File

@ -2026,7 +2026,7 @@ func doelf() {
h.Write(l.hash) h.Write(l.hash)
} }
addgonote(".note.go.abihash", ELF_NOTE_GOABIHASH_TAG, h.Sum([]byte{})) addgonote(".note.go.abihash", ELF_NOTE_GOABIHASH_TAG, h.Sum([]byte{}))
addgonote(".note.go.pkg-list", ELF_NOTE_GOPKGLIST_TAG, []byte(pkglistfornote)) addgonote(".note.go.pkg-list", ELF_NOTE_GOPKGLIST_TAG, pkglistfornote)
var deplist []string var deplist []string
for _, shlib := range Ctxt.Shlibs { for _, shlib := range Ctxt.Shlibs {
deplist = append(deplist, filepath.Base(shlib.Path)) deplist = append(deplist, filepath.Base(shlib.Path))

View File

@ -500,7 +500,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
elfobj.e = e elfobj.e = e
elfobj.f = f elfobj.f = f
elfobj.base = int64(base) elfobj.base = base
elfobj.length = length elfobj.length = length
elfobj.name = pn elfobj.name = pn
@ -612,7 +612,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
goto bad goto bad
} }
sect.nameoff = uint32(e.Uint32(b.Name[:])) sect.nameoff = e.Uint32(b.Name[:])
sect.type_ = e.Uint32(b.Type[:]) sect.type_ = e.Uint32(b.Type[:])
sect.flags = e.Uint64(b.Flags[:]) sect.flags = e.Uint64(b.Flags[:])
sect.addr = e.Uint64(b.Addr[:]) sect.addr = e.Uint64(b.Addr[:])
@ -629,7 +629,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
goto bad goto bad
} }
sect.nameoff = uint32(e.Uint32(b.Name[:])) sect.nameoff = e.Uint32(b.Name[:])
sect.type_ = e.Uint32(b.Type[:]) sect.type_ = e.Uint32(b.Type[:])
sect.flags = uint64(e.Uint32(b.Flags[:])) sect.flags = uint64(e.Uint32(b.Flags[:]))
sect.addr = uint64(e.Uint32(b.Addr[:])) sect.addr = uint64(e.Uint32(b.Addr[:]))

View File

@ -399,8 +399,8 @@ func macholoadsym(m *LdMachoObj, symtab *LdMachoSymtab) int {
return -1 return -1
} }
s.name = cstring(strbuf[v:]) s.name = cstring(strbuf[v:])
s.type_ = uint8(p[4]) s.type_ = p[4]
s.sectnum = uint8(p[5]) s.sectnum = p[5]
s.desc = m.e.Uint16(p[6:]) s.desc = m.e.Uint16(p[6:])
if m.is64 { if m.is64 {
s.value = m.e.Uint64(p[8:]) s.value = m.e.Uint64(p[8:])
@ -460,8 +460,8 @@ func ldmacho(f *bio.Reader, pkg string, length int64, pn string) {
} }
is64 = e.Uint32(hdr[:]) == 0xFEEDFACF is64 = e.Uint32(hdr[:]) == 0xFEEDFACF
ncmd = e.Uint32([]byte(hdr[4*4:])) ncmd = e.Uint32(hdr[4*4:])
cmdsz = e.Uint32([]byte(hdr[5*4:])) cmdsz = e.Uint32(hdr[5*4:])
if ncmd > 0x10000 || cmdsz >= 0x01000000 { if ncmd > 0x10000 || cmdsz >= 0x01000000 {
err = fmt.Errorf("implausible mach-o header ncmd=%d cmdsz=%d", ncmd, cmdsz) err = fmt.Errorf("implausible mach-o header ncmd=%d cmdsz=%d", ncmd, cmdsz)
goto bad goto bad
@ -475,11 +475,11 @@ func ldmacho(f *bio.Reader, pkg string, length int64, pn string) {
m.f = f m.f = f
m.e = e m.e = e
m.cputype = uint(e.Uint32([]byte(hdr[1*4:]))) m.cputype = uint(e.Uint32(hdr[1*4:]))
m.subcputype = uint(e.Uint32([]byte(hdr[2*4:]))) m.subcputype = uint(e.Uint32(hdr[2*4:]))
m.filetype = e.Uint32([]byte(hdr[3*4:])) m.filetype = e.Uint32(hdr[3*4:])
m.ncmd = uint(ncmd) m.ncmd = uint(ncmd)
m.flags = e.Uint32([]byte(hdr[6*4:])) m.flags = e.Uint32(hdr[6*4:])
m.is64 = is64 m.is64 = is64
m.base = base m.base = base
m.length = length m.length = length

View File

@ -175,14 +175,14 @@ func ldpe(f *bio.Reader, pkg string, length int64, pn string) {
// TODO return error if found .cormeta // TODO return error if found .cormeta
// load string table // load string table
f.Seek(int64(base)+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(peobj.fh.NumberOfSymbols), 0) f.Seek(base+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(peobj.fh.NumberOfSymbols), 0)
if _, err := io.ReadFull(f, symbuf[:4]); err != nil { if _, err := io.ReadFull(f, symbuf[:4]); err != nil {
goto bad goto bad
} }
l = Le32(symbuf[:]) l = Le32(symbuf[:])
peobj.snames = make([]byte, l) peobj.snames = make([]byte, l)
f.Seek(int64(base)+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(peobj.fh.NumberOfSymbols), 0) f.Seek(base+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(peobj.fh.NumberOfSymbols), 0)
if _, err := io.ReadFull(f, peobj.snames); err != nil { if _, err := io.ReadFull(f, peobj.snames); err != nil {
goto bad goto bad
} }
@ -203,9 +203,9 @@ func ldpe(f *bio.Reader, pkg string, length int64, pn string) {
peobj.pesym = make([]PeSym, peobj.fh.NumberOfSymbols) peobj.pesym = make([]PeSym, peobj.fh.NumberOfSymbols)
peobj.npesym = uint(peobj.fh.NumberOfSymbols) peobj.npesym = uint(peobj.fh.NumberOfSymbols)
f.Seek(int64(base)+int64(peobj.fh.PointerToSymbolTable), 0) f.Seek(base+int64(peobj.fh.PointerToSymbolTable), 0)
for i := 0; uint32(i) < peobj.fh.NumberOfSymbols; i += numaux + 1 { for i := 0; uint32(i) < peobj.fh.NumberOfSymbols; i += numaux + 1 {
f.Seek(int64(base)+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(i), 0) f.Seek(base+int64(peobj.fh.PointerToSymbolTable)+int64(len(symbuf))*int64(i), 0)
if _, err := io.ReadFull(f, symbuf[:]); err != nil { if _, err := io.ReadFull(f, symbuf[:]); err != nil {
goto bad goto bad
} }

View File

@ -765,7 +765,7 @@ func nextar(bp *bio.Reader, off int64, a *ArHdr) int64 {
if arsize&1 != 0 { if arsize&1 != 0 {
arsize++ arsize++
} }
return int64(arsize) + SAR_HDR return arsize + SAR_HDR
} }
func objfile(lib *Library) { func objfile(lib *Library) {
@ -1953,7 +1953,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
continue continue
} }
if len(s.P) > 0 { if len(s.P) > 0 {
Diag("%s should not be bss (size=%d type=%d special=%v)", s.Name, int(len(s.P)), s.Type, s.Attr.Special()) Diag("%s should not be bss (size=%d type=%d special=%v)", s.Name, len(s.P), s.Type, s.Attr.Special())
} }
put(s, s.Name, 'B', Symaddr(s), s.Size, int(s.Version), s.Gotype) put(s, s.Name, 'B', Symaddr(s), s.Size, int(s.Version), s.Gotype)

View File

@ -703,11 +703,11 @@ func machosymtab() {
Addstring(symstr, s.Extname) Addstring(symstr, s.Extname)
} else { } else {
for p = s.Extname; p != ""; p = p[1:] { for p = s.Extname; p != ""; p = p[1:] {
if uint8(p[0]) == 0xc2 && uint8((p[1:])[0]) == 0xb7 { if p[0] == 0xc2 && (p[1:])[0] == 0xb7 {
Adduint8(Ctxt, symstr, '.') Adduint8(Ctxt, symstr, '.')
p = p[1:] p = p[1:]
} else { } else {
Adduint8(Ctxt, symstr, uint8(p[0])) Adduint8(Ctxt, symstr, p[0])
} }
} }

View File

@ -472,7 +472,7 @@ func (r *objReader) readInt64() int64 {
} }
} }
return int64(uv>>1) ^ (int64(uint64(uv)<<63) >> 63) return int64(uv>>1) ^ (int64(uv<<63) >> 63)
} }
func (r *objReader) readInt() int { func (r *objReader) readInt() int {

View File

@ -179,7 +179,7 @@ func renumberfiles(ctxt *Link, files []*LSym, d *Pcdata) {
dv = val - newval dv = val - newval
newval = val newval = val
v = (uint32(dv) << 1) ^ uint32(int32(dv>>31)) v = (uint32(dv) << 1) ^ uint32(dv>>31)
addvarint(&out, v) addvarint(&out, v)
// pc delta // pc delta
@ -378,7 +378,7 @@ func pclntab() {
ftab.Size = int64(len(ftab.P)) ftab.Size = int64(len(ftab.P))
if Debug['v'] != 0 { if Debug['v'] != 0 {
fmt.Fprintf(Bso, "%5.2f pclntab=%d bytes, funcdata total %d bytes\n", obj.Cputime(), int64(ftab.Size), int64(funcdata_bytes)) fmt.Fprintf(Bso, "%5.2f pclntab=%d bytes, funcdata total %d bytes\n", obj.Cputime(), ftab.Size, funcdata_bytes)
} }
} }

View File

@ -877,7 +877,7 @@ func peemitreloc(text, data, ctors *IMAGE_SECTION_HEADER) {
ctors.NumberOfRelocations = 1 ctors.NumberOfRelocations = 1
ctors.PointerToRelocations = uint32(Cpos()) ctors.PointerToRelocations = uint32(Cpos())
sectoff := ctors.VirtualAddress sectoff := ctors.VirtualAddress
Lputl(uint32(sectoff)) Lputl(sectoff)
Lputl(uint32(dottext.Dynid)) Lputl(uint32(dottext.Dynid))
switch obj.Getgoarch() { switch obj.Getgoarch() {
default: default:
@ -1043,7 +1043,7 @@ func addpesymtable() {
// write COFF string table // write COFF string table
Lputl(uint32(len(strtbl)) + 4) Lputl(uint32(len(strtbl)) + 4)
for i := 0; i < len(strtbl); i++ { for i := 0; i < len(strtbl); i++ {
Cput(uint8(strtbl[i])) Cput(strtbl[i])
} }
if Linkmode != LinkExternal { if Linkmode != LinkExternal {
strnput("", int(h.SizeOfRawData-uint32(size))) strnput("", int(h.SizeOfRawData-uint32(size)))

View File

@ -236,10 +236,10 @@ func putplan9sym(x *LSym, s string, t int, addr int64, size int64, ver int, go_
var i int var i int
if t == 'z' || t == 'Z' { if t == 'z' || t == 'Z' {
Cput(uint8(s[0])) Cput(s[0])
for i = 1; s[i] != 0 || s[i+1] != 0; i += 2 { for i = 1; s[i] != 0 || s[i+1] != 0; i += 2 {
Cput(uint8(s[i])) Cput(s[i])
Cput(uint8(s[i+1])) Cput(s[i+1])
} }
Cput(0) Cput(0)
@ -251,7 +251,7 @@ func putplan9sym(x *LSym, s string, t int, addr int64, size int64, ver int, go_
s = s[1:] s = s[1:]
} }
for i = 0; i < len(s); i++ { for i = 0; i < len(s); i++ {
Cput(uint8(s[i])) Cput(s[i])
} }
Cput(0) Cput(0)
} }

View File

@ -193,7 +193,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()
@ -214,7 +214,7 @@ func asmb() {
if ld.SysArch == sys.ArchMIPS64LE { if ld.SysArch == sys.ArchMIPS64LE {
magic = uint32(4*26*26 + 7) magic = uint32(4*26*26 + 7)
} }
ld.Thearch.Lput(uint32(magic)) /* magic */ ld.Thearch.Lput(magic) /* magic */
ld.Thearch.Lput(uint32(ld.Segtext.Filelen)) /* sizes */ ld.Thearch.Lput(uint32(ld.Segtext.Filelen)) /* sizes */
ld.Thearch.Lput(uint32(ld.Segdata.Filelen)) ld.Thearch.Lput(uint32(ld.Segdata.Filelen))
ld.Thearch.Lput(uint32(ld.Segdata.Length - ld.Segdata.Filelen)) ld.Thearch.Lput(uint32(ld.Segdata.Length - ld.Segdata.Filelen))

View File

@ -913,7 +913,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()

View File

@ -699,7 +699,7 @@ func asmb() {
if sym != nil { if sym != nil {
ld.Lcsize = int32(len(sym.P)) ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ { for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(uint8(sym.P[i])) ld.Cput(sym.P[i])
} }
ld.Cflush() ld.Cflush()

View File

@ -111,7 +111,7 @@ func validateStructTag(tag string) error {
if i >= len(tag) { if i >= len(tag) {
return errTagValueSyntax return errTagValueSyntax
} }
qvalue := string(tag[:i+1]) qvalue := tag[:i+1]
tag = tag[i+1:] tag = tag[i+1:]
if _, err := strconv.Unquote(qvalue); err != nil { if _, err := strconv.Unquote(qvalue); err != nil {