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>
}
p.pendingLabels = p.pendingLabels[0:0]
}
- prog.Pc = int64(p.pc)
+ prog.Pc = p.pc
if *flags.Debug {
fmt.Println(p.histLineNum, prog)
}
Offset: p.getConstant(prog, op, &a[0]),
}
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 {
p.errorf("bad register number %d", reg)
return
}
for _, spec := range d.Specs {
s, ok := spec.(*ast.ImportSpec)
- if !ok || string(s.Path.Value) != `"C"` {
+ if !ok || s.Path.Value != `"C"` {
continue
}
sawC = true
ws := 0
for _, spec := range d.Specs {
s, ok := spec.(*ast.ImportSpec)
- if !ok || string(s.Path.Value) != `"C"` {
+ if !ok || s.Path.Value != `"C"` {
d.Specs[ws] = spec
ws++
}
}
var pieces []string
for _, com := range g.List {
- c := string(com.Text)
+ c := com.Text
// Remove comment markers.
// The parser has given us exactly the comment text.
switch c[1] {
return
}
for _, c := range n.Doc.List {
- if !strings.HasPrefix(string(c.Text), "//export ") {
+ if !strings.HasPrefix(c.Text, "//export ") {
continue
}
- name := strings.TrimSpace(string(c.Text[9:]))
+ name := strings.TrimSpace(c.Text[9:])
if name == "" {
error_(c.Pos(), "export missing name")
}
}
}
- t := obj.Prog(*r0.Prog)
+ t := *r0.Prog
for r = gc.Uniqp(r0); ; r = gc.Uniqp(r) {
p0 = r.Link.Prog
p := r.Prog
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
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)
if r == r0 {
break
// when we're connecting to https servers that might not be there
// or might be using self-signed certificates.
var impatientInsecureHTTPClient = &http.Client{
- Timeout: time.Duration(5 * time.Second),
+ Timeout: 5 * time.Second,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
return "", fmt.Errorf("unable to parse output of bzr info")
}
out = out[:i]
- return strings.TrimSpace(string(out)), nil
+ return strings.TrimSpace(out), nil
}
// vcsSvn describes how to use Subversion.
return "", fmt.Errorf("unable to parse output of svn info")
}
out = out[:i]
- return strings.TrimSpace(string(out)), nil
+ return strings.TrimSpace(out), nil
}
func (v *vcsCmd) String() string {
if p.From.Type == obj.TYPE_FCONST {
f32 := float32(p.From.Val.(float64))
i32 := math.Float32bits(f32)
- literal := fmt.Sprintf("$f32.%08x", uint32(i32))
+ literal := fmt.Sprintf("$f32.%08x", i32)
s := obj.Linklookup(ctxt, literal, 0)
s.Size = 4
p.From.Type = obj.TYPE_MEM
case AFMOVD:
if p.From.Type == obj.TYPE_FCONST {
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.Size = 8
p.From.Type = obj.TYPE_MEM
case 4:
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v))
case 8:
- ctxt.Arch.ByteOrder.PutUint64(s.P[off:], uint64(v))
+ ctxt.Arch.ByteOrder.PutUint64(s.P[off:], v)
}
return off + wid
o1 = OP_IRR(opirr(ctxt, p.As), uint32(v), uint32(r), uint32(p.To.Reg))
case 5: /* syscall */
- o1 = uint32(oprrr(ctxt, p.As))
+ o1 = oprrr(ctxt, p.As)
case 6: /* beq r1,[r2],sbra */
v := int32(0)
name = "TLS"
}
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 {
- 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)
}
}
}
func (w *objWriter) writeInt(sval int64) {
var v uint64
- uv := (uint64(sval) << 1) ^ uint64(int64(sval>>63))
+ uv := (uint64(sval) << 1) ^ uint64(sval>>63)
p := w.varintbuf[:]
for v = uv; v >= 0x80; v >>= 7 {
p[0] = uint8(v | 0x80)
if val == oldval && started != 0 {
val = valfunc(ctxt, func_, val, p, 1, arg)
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
}
if p.Link != nil && p.Link.Pc == p.Pc {
val = valfunc(ctxt, func_, val, p, 1, arg)
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
}
// where the 0x80 bit indicates that the integer continues.
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 {
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, 0) // terminator
if file == f {
pcln.Lastfile = f
pcln.Lastindex = int(i)
- return int32(i)
+ return i
}
}
pcln.File = append(pcln.File, f)
// which relocation to use with a load or store and only supports the needed
// instructions.
func opform(ctxt *obj.Link, insn uint32) int {
- switch uint32(insn) {
+ switch insn {
default:
ctxt.Diag("bad insn in loadform: %x", insn)
case OPVCC(58, 0, 0, 0), // ld
}
v := oprrr(ctxt, p.As)
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))
- 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 {
o4 = o3
}
v := oprrr(ctxt, p.As)
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))
- 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) */
v := regoff(ctxt, &p.From) & 31
ctxt.Diag("invalid offset against tls var %v", p)
}
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.Off = int32(ctxt.Pc)
rel.Siz = 8
}
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.Off = int32(ctxt.Pc)
rel.Siz = 8
case TYPE_SHIFT:
v := int(a.Offset)
- op := string("<<>>->@>"[((v>>5)&3)<<1:])
+ op := "<<>>->@>"[((v>>5)&3)<<1:]
if v&(1<<4) != 0 {
str = fmt.Sprintf("R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15)
} else {
case Pf2, /* xmm opcode escape */
Pf3:
- ctxt.AsmBuf.Put2(byte(o.prefix), Pm)
+ ctxt.AsmBuf.Put2(o.prefix, Pm)
case Pef3:
ctxt.AsmBuf.Put3(Pe, Pf3, Pm)
asmand(ctxt, p, &p.From, &p.To)
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)
case Zm_r_xm:
}
ctxt.AsmBuf.Put1(byte(op))
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)))
if yt.zcase == Zcallcon {
ctxt.AsmBuf.Put1(byte(op))
} else {
- ctxt.AsmBuf.Put1(byte(o.op[z+1]))
+ ctxt.AsmBuf.Put1(o.op[z+1])
}
r = obj.Addrel(ctxt.Cursym)
r.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
ctxt.AsmBuf.PutInt32(0)
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.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
r.Type = obj.R_ADDR
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.Off = int32(p.Pc + int64(ctxt.AsmBuf.Len()))
r.Sym = p.To.Sym
v--
}
- ctxt.AsmBuf.Put1(byte(o.op[z+1]))
+ ctxt.AsmBuf.Put1(o.op[z+1])
ctxt.AsmBuf.PutInt32(int32(v))
}
if yt.zcase == Zbr {
ctxt.AsmBuf.Put1(0x0f)
}
- ctxt.AsmBuf.Put1(byte(o.op[z+1]))
+ ctxt.AsmBuf.Put1(o.op[z+1])
ctxt.AsmBuf.PutInt32(0)
}
if !validSymType[s.Type] {
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 })
if i < len(addrs) {
sym.Size = int64(addrs[i] - s.Value)
if m == nil {
return nil, errUnrecognized
}
- profileType := string(m[1])
+ profileType := m[1]
p := &Profile{
PeriodType: &ValueType{Type: profileType, Unit: "count"},
Period: 1,
if m == nil {
return nil, errMalformed
}
- n, err := strconv.ParseInt(string(m[1]), 0, 64)
+ n, err := strconv.ParseInt(m[1], 0, 64)
if err != nil {
return nil, errMalformed
}
- fields := strings.Fields(string(m[2]))
+ fields := strings.Fields(m[2])
locs := make([]*Location, 0, len(fields))
for _, stk := range fields {
addr, err := strconv.ParseUint(stk, 0, 64)
}
p.Sample = append(p.Sample,
&Sample{
- Value: []int64{int64(count), int64(count) * int64(p.Period)},
+ Value: []int64{int64(count), int64(count) * p.Period},
Location: sloc,
})
}
var period int64
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
}
}
typ, count := decodeShift(x)
// ROR #0 here means ROR #0, but decodeShift rewrites to RRX #1.
if typ == RotateRightExt {
- return Reg(Rm)
+ return Rm
}
- return RegShift{Rm, typ, uint8(count)}
+ return RegShift{Rm, typ, count}
case arg_R_shift_R:
Rm := Reg(x & (1<<4 - 1))
Rm := Reg(x & (1<<4 - 1))
typ, count := decodeShift(x)
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:
return Reg((x & (1<<4 - 1)))
case xArgMoffs8, xArgMoffs16, xArgMoffs32, xArgMoffs64:
// TODO(rsc): Can address be 64 bits?
- mem = Mem{Disp: int64(immc)}
+ mem = Mem{Disp: immc}
if segIndex >= 0 {
mem.Segment = prefixToSegment(inst.Prefix[segIndex])
inst.Prefix[segIndex] |= PrefixImplicit
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
case 4:
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(v))
case 8:
- ctxt.Arch.ByteOrder.PutUint64(s.P[off:], uint64(v))
+ ctxt.Arch.ByteOrder.PutUint64(s.P[off:], v)
}
return off + wid
}
Ctxt.Cursym = sym
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()
}
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()
}
}
if addr < sym.Value {
- fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(int64(addr)))
+ fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
for ; addr < sym.Value; addr++ {
fmt.Fprintf(Bso, " %.2x", 0)
}
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
for len(q) >= 16 {
}
if addr < eaddr {
- fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(int64(addr)))
+ fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
for ; addr < eaddr; addr++ {
fmt.Fprintf(Bso, " %.2x", 0)
}
p = sym.P
ep = p[len(sym.P):]
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, " %.2x", p[0])
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)
}
}
}
for s := datap; s != nil; s = s.Next {
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))
}
}
// Type.commonType.kind
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
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
Adduint8(Ctxt, s, uint8(value))
p := data.([]byte)
for i := 0; int64(i) < value; i++ {
- Adduint8(Ctxt, s, uint8(p[i]))
+ Adduint8(Ctxt, s, p[i])
}
case DW_FORM_block2: // block
Adduint16(Ctxt, s, uint16(value))
p := data.([]byte)
for i := 0; int64(i) < value; i++ {
- Adduint8(Ctxt, s, uint8(p[i]))
+ Adduint8(Ctxt, s, p[i])
}
case DW_FORM_block4: // block
Adduint32(Ctxt, s, uint32(value))
p := data.([]byte)
for i := 0; int64(i) < value; i++ {
- Adduint8(Ctxt, s, uint8(p[i]))
+ Adduint8(Ctxt, s, p[i])
}
case DW_FORM_block: // block
p := data.([]byte)
for i := 0; int64(i) < value; i++ {
- Adduint8(Ctxt, s, uint8(p[i]))
+ Adduint8(Ctxt, s, p[i])
}
case DW_FORM_data1: // constant
// Construct type to represent an array of BucketSize keys
keyname := nameFromDIESym(keytype)
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
if indirect_key {
t = defptrto(keytype)
// Construct type to represent an array of BucketSize values
valname := nameFromDIESym(valtype)
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
if indirect_val {
t = defptrto(valtype)
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>
} else {
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>
}
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
}
h.Write(l.hash)
}
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
for _, shlib := range Ctxt.Shlibs {
deplist = append(deplist, filepath.Base(shlib.Path))
elfobj.e = e
elfobj.f = f
- elfobj.base = int64(base)
+ elfobj.base = base
elfobj.length = length
elfobj.name = pn
goto bad
}
- sect.nameoff = uint32(e.Uint32(b.Name[:]))
+ sect.nameoff = e.Uint32(b.Name[:])
sect.type_ = e.Uint32(b.Type[:])
sect.flags = e.Uint64(b.Flags[:])
sect.addr = e.Uint64(b.Addr[:])
goto bad
}
- sect.nameoff = uint32(e.Uint32(b.Name[:]))
+ sect.nameoff = e.Uint32(b.Name[:])
sect.type_ = e.Uint32(b.Type[:])
sect.flags = uint64(e.Uint32(b.Flags[:]))
sect.addr = uint64(e.Uint32(b.Addr[:]))
return -1
}
s.name = cstring(strbuf[v:])
- s.type_ = uint8(p[4])
- s.sectnum = uint8(p[5])
+ s.type_ = p[4]
+ s.sectnum = p[5]
s.desc = m.e.Uint16(p[6:])
if m.is64 {
s.value = m.e.Uint64(p[8:])
}
is64 = e.Uint32(hdr[:]) == 0xFEEDFACF
- ncmd = e.Uint32([]byte(hdr[4*4:]))
- cmdsz = e.Uint32([]byte(hdr[5*4:]))
+ ncmd = e.Uint32(hdr[4*4:])
+ cmdsz = e.Uint32(hdr[5*4:])
if ncmd > 0x10000 || cmdsz >= 0x01000000 {
err = fmt.Errorf("implausible mach-o header ncmd=%d cmdsz=%d", ncmd, cmdsz)
goto bad
m.f = f
m.e = e
- m.cputype = uint(e.Uint32([]byte(hdr[1*4:])))
- m.subcputype = uint(e.Uint32([]byte(hdr[2*4:])))
- m.filetype = e.Uint32([]byte(hdr[3*4:]))
+ m.cputype = uint(e.Uint32(hdr[1*4:]))
+ m.subcputype = uint(e.Uint32(hdr[2*4:]))
+ m.filetype = e.Uint32(hdr[3*4:])
m.ncmd = uint(ncmd)
- m.flags = e.Uint32([]byte(hdr[6*4:]))
+ m.flags = e.Uint32(hdr[6*4:])
m.is64 = is64
m.base = base
m.length = length
// TODO return error if found .cormeta
// 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 {
goto bad
}
l = Le32(symbuf[:])
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 {
goto bad
}
peobj.pesym = make([]PeSym, 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 {
- 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 {
goto bad
}
if arsize&1 != 0 {
arsize++
}
- return int64(arsize) + SAR_HDR
+ return arsize + SAR_HDR
}
func objfile(lib *Library) {
continue
}
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)
Addstring(symstr, s.Extname)
} else {
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, '.')
p = p[1:]
} else {
- Adduint8(Ctxt, symstr, uint8(p[0]))
+ Adduint8(Ctxt, symstr, p[0])
}
}
}
}
- return int64(uv>>1) ^ (int64(uint64(uv)<<63) >> 63)
+ return int64(uv>>1) ^ (int64(uv<<63) >> 63)
}
func (r *objReader) readInt() int {
dv = val - newval
newval = val
- v = (uint32(dv) << 1) ^ uint32(int32(dv>>31))
+ v = (uint32(dv) << 1) ^ uint32(dv>>31)
addvarint(&out, v)
// pc delta
ftab.Size = int64(len(ftab.P))
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)
}
}
ctors.NumberOfRelocations = 1
ctors.PointerToRelocations = uint32(Cpos())
sectoff := ctors.VirtualAddress
- Lputl(uint32(sectoff))
+ Lputl(sectoff)
Lputl(uint32(dottext.Dynid))
switch obj.Getgoarch() {
default:
// write COFF string table
Lputl(uint32(len(strtbl)) + 4)
for i := 0; i < len(strtbl); i++ {
- Cput(uint8(strtbl[i]))
+ Cput(strtbl[i])
}
if Linkmode != LinkExternal {
strnput("", int(h.SizeOfRawData-uint32(size)))
var i int
if t == 'z' || t == 'Z' {
- Cput(uint8(s[0]))
+ Cput(s[0])
for i = 1; s[i] != 0 || s[i+1] != 0; i += 2 {
- Cput(uint8(s[i]))
- Cput(uint8(s[i+1]))
+ Cput(s[i])
+ Cput(s[i+1])
}
Cput(0)
s = s[1:]
}
for i = 0; i < len(s); i++ {
- Cput(uint8(s[i]))
+ Cput(s[i])
}
Cput(0)
}
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
if ld.SysArch == sys.ArchMIPS64LE {
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.Segdata.Filelen))
ld.Thearch.Lput(uint32(ld.Segdata.Length - ld.Segdata.Filelen))
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
- ld.Cput(uint8(sym.P[i]))
+ ld.Cput(sym.P[i])
}
ld.Cflush()
if i >= len(tag) {
return errTagValueSyntax
}
- qvalue := string(tag[:i+1])
+ qvalue := tag[:i+1]
tag = tag[i+1:]
if _, err := strconv.Unquote(qvalue); err != nil {