Commit f84a1db1 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/link: replace unrolled Cput loops with Cwrite/Cwritestring

Passes toolstash-check -all.

Change-Id: I1c85a2c0390517f4e9cdbddddbf3c353edca65b3
Reviewed-on: https://go-review.googlesource.com/64051
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 165c15af
......@@ -781,10 +781,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
......
......@@ -829,10 +829,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
......
......@@ -465,10 +465,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
......
......@@ -1120,9 +1120,7 @@ func getElfEhdr() *ElfEhdr {
}
func elf64writehdr() uint32 {
for i := 0; i < EI_NIDENT; i++ {
Cput(ehdr.ident[i])
}
Cwrite(ehdr.ident[:])
Thearch.Wput(ehdr.type_)
Thearch.Wput(ehdr.machine)
Thearch.Lput(ehdr.version)
......@@ -1140,9 +1138,7 @@ func elf64writehdr() uint32 {
}
func elf32writehdr() uint32 {
for i := 0; i < EI_NIDENT; i++ {
Cput(ehdr.ident[i])
}
Cwrite(ehdr.ident[:])
Thearch.Wput(ehdr.type_)
Thearch.Wput(ehdr.machine)
Thearch.Lput(ehdr.version)
......
......@@ -233,13 +233,10 @@ func putplan9sym(ctxt *Link, x *Symbol, s string, typ SymbolType, addr int64, go
Lputb(uint32(addr))
Cput(uint8(t + 0x80)) /* 0x80 is variable length */
var i int
for i = 0; i < len(s); i++ {
Cput(s[i])
}
Cwritestring(s)
Cput(0)
Symsize += int32(l) + 1 + int32(i) + 1
Symsize += int32(l) + 1 + int32(len(s)) + 1
default:
return
......
......@@ -258,10 +258,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
}
......
......@@ -987,10 +987,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
}
......
......@@ -709,10 +709,7 @@ func asmb(ctxt *ld.Link) {
sym := ctxt.Syms.Lookup("pclntab", 0)
if sym != nil {
ld.Lcsize = int32(len(sym.P))
for i := 0; int32(i) < ld.Lcsize; i++ {
ld.Cput(sym.P[i])
}
ld.Cwrite(sym.P)
ld.Cflush()
}
......
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