Commit c3e8a20a authored by nikita-vanyasin's avatar nikita-vanyasin Committed by Josh Bleecher Snyder

cmd/link/internal: eliminate all ld.Cputime() usages

Also a similar 'elapsed' function and its usages were deleted.

Fixes #19865.

Change-Id: Ib125365e69cf2eda60de64fa74290c8c7d1fd65a
Reviewed-on: https://go-review.googlesource.com/c/go/+/171730
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
Reviewed-by: default avatarThan McIntosh <thanm@google.com>
parent 65a1e242
...@@ -659,14 +659,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) { ...@@ -659,14 +659,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f codeblk\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -681,24 +673,14 @@ func asmb(ctxt *ld.Link) { ...@@ -681,24 +673,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f relrodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -740,9 +722,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -740,9 +722,6 @@ func asmb2(ctxt *ld.Link) {
ld.Lcsize = 0 ld.Lcsize = 0
symo := int64(0) symo := int64(0)
if !*ld.FlagS { if !*ld.FlagS {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
case objabi.Hplan9: case objabi.Hplan9:
...@@ -775,10 +754,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -775,10 +754,6 @@ func asmb2(ctxt *ld.Link) {
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
ld.Elfemitreloc(ctxt) ld.Elfemitreloc(ctxt)
} }
...@@ -796,9 +771,7 @@ func asmb2(ctxt *ld.Link) { ...@@ -796,9 +771,7 @@ func asmb2(ctxt *ld.Link) {
} }
case objabi.Hwindows: case objabi.Hwindows:
if ctxt.Debugvlog != 0 { // Do nothing
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
case objabi.Hdarwin: case objabi.Hdarwin:
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
...@@ -807,9 +780,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -807,9 +780,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f headr\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -760,10 +760,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) { ...@@ -760,10 +760,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -777,24 +773,14 @@ func asmb(ctxt *ld.Link) { ...@@ -777,24 +773,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f relrodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -815,9 +801,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -815,9 +801,6 @@ func asmb2(ctxt *ld.Link) {
symo := uint32(0) symo := uint32(0)
if !*ld.FlagS { if !*ld.FlagS {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
...@@ -840,9 +823,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -840,9 +823,6 @@ func asmb2(ctxt *ld.Link) {
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
...@@ -864,9 +844,7 @@ func asmb2(ctxt *ld.Link) { ...@@ -864,9 +844,7 @@ func asmb2(ctxt *ld.Link) {
} }
case objabi.Hwindows: case objabi.Hwindows:
if ctxt.Debugvlog != 0 { // Do nothing
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
case objabi.Hdarwin: case objabi.Hdarwin:
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
...@@ -875,9 +853,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -875,9 +853,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -803,10 +803,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) { ...@@ -803,10 +803,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -820,24 +816,14 @@ func asmb(ctxt *ld.Link) { ...@@ -820,24 +816,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f relrodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -858,9 +844,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -858,9 +844,6 @@ func asmb2(ctxt *ld.Link) {
symo := uint32(0) symo := uint32(0)
if !*ld.FlagS { if !*ld.FlagS {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
...@@ -879,9 +862,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -879,9 +862,6 @@ func asmb2(ctxt *ld.Link) {
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
...@@ -909,9 +889,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -909,9 +889,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -559,10 +559,6 @@ func relocsym(ctxt *Link, s *sym.Symbol) { ...@@ -559,10 +559,6 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
} }
func (ctxt *Link) reloc() { func (ctxt *Link) reloc() {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f reloc\n", Cputime())
}
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
relocsym(ctxt, s) relocsym(ctxt, s)
} }
...@@ -623,9 +619,6 @@ func (ctxt *Link) windynrelocsyms() { ...@@ -623,9 +619,6 @@ func (ctxt *Link) windynrelocsyms() {
if !(ctxt.HeadType == objabi.Hwindows && iscgo && ctxt.LinkMode == LinkInternal) { if !(ctxt.HeadType == objabi.Hwindows && iscgo && ctxt.LinkMode == LinkInternal) {
return return
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f windynrelocsyms\n", Cputime())
}
/* relocation table */ /* relocation table */
rel := ctxt.Syms.Lookup(".rel", 0) rel := ctxt.Syms.Lookup(".rel", 0)
...@@ -672,9 +665,6 @@ func dynreloc(ctxt *Link, data *[sym.SXREF][]*sym.Symbol) { ...@@ -672,9 +665,6 @@ func dynreloc(ctxt *Link, data *[sym.SXREF][]*sym.Symbol) {
if *FlagD { if *FlagD {
return return
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dynreloc\n", Cputime())
}
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
dynrelocsym(ctxt, s) dynrelocsym(ctxt, s)
...@@ -1143,10 +1133,6 @@ func checkdatsize(ctxt *Link, datsize int64, symn sym.SymKind) { ...@@ -1143,10 +1133,6 @@ func checkdatsize(ctxt *Link, datsize int64, symn sym.SymKind) {
var datap []*sym.Symbol var datap []*sym.Symbol
func (ctxt *Link) dodata() { func (ctxt *Link) dodata() {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dodata\n", Cputime())
}
if (ctxt.DynlinkingGo() && ctxt.HeadType == objabi.Hdarwin) || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) { if (ctxt.DynlinkingGo() && ctxt.HeadType == objabi.Hdarwin) || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) {
// The values in moduledata are filled out by relocations // The values in moduledata are filled out by relocations
// pointing to the addresses of these special symbols. // pointing to the addresses of these special symbols.
......
...@@ -46,10 +46,6 @@ import ( ...@@ -46,10 +46,6 @@ import (
// //
// Any unreached text symbols are removed from ctxt.Textp. // Any unreached text symbols are removed from ctxt.Textp.
func deadcode(ctxt *Link) { func deadcode(ctxt *Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f deadcode\n", Cputime())
}
d := &deadcodepass{ d := &deadcodepass{
ctxt: ctxt, ctxt: ctxt,
ifaceMethod: make(map[methodsig]bool), ifaceMethod: make(map[methodsig]bool),
......
...@@ -1798,10 +1798,6 @@ func dwarfGenerateDebugSyms(ctxt *Link) { ...@@ -1798,10 +1798,6 @@ func dwarfGenerateDebugSyms(ctxt *Link) {
return return
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dwarf\n", Cputime())
}
abbrev := writeabbrev(ctxt) abbrev := writeabbrev(ctxt)
syms := []*sym.Symbol{abbrev} syms := []*sym.Symbol{abbrev}
......
...@@ -165,7 +165,7 @@ func addlib(ctxt *Link, src string, obj string, lib string) *sym.Library { ...@@ -165,7 +165,7 @@ func addlib(ctxt *Link, src string, obj string, lib string) *sym.Library {
pname, isshlib := findlib(ctxt, lib) pname, isshlib := findlib(ctxt, lib)
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f addlib: %s %s pulls in %s isshlib %v\n", elapsed(), obj, src, pname, isshlib) ctxt.Logf("addlib: %s %s pulls in %s isshlib %v\n", obj, src, pname, isshlib)
} }
if isshlib { if isshlib {
...@@ -188,7 +188,7 @@ func addlibpath(ctxt *Link, srcref string, objref string, file string, pkg strin ...@@ -188,7 +188,7 @@ func addlibpath(ctxt *Link, srcref string, objref string, file string, pkg strin
} }
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f addlibpath: srcref: %s objref: %s file: %s pkg: %s shlib: %s\n", Cputime(), srcref, objref, file, pkg, shlib) ctxt.Logf("addlibpath: srcref: %s objref: %s file: %s pkg: %s shlib: %s\n", srcref, objref, file, pkg, shlib)
} }
l := &sym.Library{} l := &sym.Library{}
......
...@@ -402,7 +402,7 @@ func (ctxt *Link) loadlib() { ...@@ -402,7 +402,7 @@ func (ctxt *Link) loadlib() {
lib := ctxt.Library[i] lib := ctxt.Library[i]
if lib.Shlib == "" { if lib.Shlib == "" {
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), lib.File, lib.Objref) ctxt.Logf("autolib: %s (from %s)\n", lib.File, lib.Objref)
} }
loadobjfile(ctxt, lib) loadobjfile(ctxt, lib)
} }
...@@ -411,7 +411,7 @@ func (ctxt *Link) loadlib() { ...@@ -411,7 +411,7 @@ func (ctxt *Link) loadlib() {
for _, lib := range ctxt.Library { for _, lib := range ctxt.Library {
if lib.Shlib != "" { if lib.Shlib != "" {
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), lib.Shlib, lib.Objref) ctxt.Logf("autolib: %s (from %s)\n", lib.Shlib, lib.Objref)
} }
ldshlibsyms(ctxt, lib.Shlib) ldshlibsyms(ctxt, lib.Shlib)
} }
...@@ -842,7 +842,7 @@ func loadobjfile(ctxt *Link, lib *sym.Library) { ...@@ -842,7 +842,7 @@ func loadobjfile(ctxt *Link, lib *sym.Library) {
pkg := objabi.PathToPrefix(lib.Pkg) pkg := objabi.PathToPrefix(lib.Pkg)
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f ldobj: %s (%s)\n", Cputime(), lib.File, pkg) ctxt.Logf("ldobj: %s (%s)\n", lib.File, pkg)
} }
f, err := bio.Open(lib.File) f, err := bio.Open(lib.File)
if err != nil { if err != nil {
...@@ -1439,7 +1439,7 @@ func (ctxt *Link) hostlink() { ...@@ -1439,7 +1439,7 @@ func (ctxt *Link) hostlink() {
} }
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f host link:", Cputime()) ctxt.Logf("host link:")
for _, v := range argv { for _, v := range argv {
ctxt.Logf(" %q", v) ctxt.Logf(" %q", v)
} }
...@@ -1877,7 +1877,7 @@ func ldshlibsyms(ctxt *Link, shlib string) { ...@@ -1877,7 +1877,7 @@ func ldshlibsyms(ctxt *Link, shlib string) {
} }
} }
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f ldshlibsyms: found library with name %s at %s\n", Cputime(), shlib, libpath) ctxt.Logf("ldshlibsyms: found library with name %s at %s\n", shlib, libpath)
} }
f, err := elf.Open(libpath) f, err := elf.Open(libpath)
...@@ -2387,7 +2387,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6 ...@@ -2387,7 +2387,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
} }
if ctxt.Debugvlog != 0 || *flagN { if ctxt.Debugvlog != 0 || *flagN {
ctxt.Logf("%5.2f symsize = %d\n", Cputime(), uint32(Symsize)) ctxt.Logf("symsize = %d\n", uint32(Symsize))
} }
} }
......
...@@ -274,7 +274,6 @@ func Main(arch *sys.Arch, theArch Arch) { ...@@ -274,7 +274,6 @@ func Main(arch *sys.Arch, theArch Arch) {
ctxt.hostlink() ctxt.hostlink()
ctxt.archive() ctxt.archive()
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f cpu time\n", Cputime())
ctxt.Logf("%d symbols\n", len(ctxt.Syms.Allsym)) ctxt.Logf("%d symbols\n", len(ctxt.Syms.Allsym))
ctxt.Logf("%d liveness data\n", liveness) ctxt.Logf("%d liveness data\n", liveness)
} }
......
...@@ -393,7 +393,7 @@ func (ctxt *Link) pclntab() { ...@@ -393,7 +393,7 @@ func (ctxt *Link) pclntab() {
ftab.Size = int64(len(ftab.P)) ftab.Size = int64(len(ftab.P))
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f pclntab=%d bytes, funcdata total %d bytes\n", Cputime(), ftab.Size, funcdataBytes) ctxt.Logf("pclntab=%d bytes, funcdata total %d bytes\n", ftab.Size, funcdataBytes)
} }
} }
......
...@@ -9,19 +9,8 @@ import ( ...@@ -9,19 +9,8 @@ import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"os" "os"
"time"
) )
var startTime time.Time
// TODO(josharian): delete. See issue 19865.
func Cputime() float64 {
if startTime.IsZero() {
startTime = time.Now()
}
return time.Since(startTime).Seconds()
}
var atExitFuncs []func() var atExitFuncs []func()
func AtExit(f func()) { func AtExit(f func()) {
...@@ -84,12 +73,6 @@ func stringtouint32(x []uint32, s string) { ...@@ -84,12 +73,6 @@ func stringtouint32(x []uint32, s string) {
} }
} }
var start = time.Now()
func elapsed() float64 {
return time.Since(start).Seconds()
}
// contains reports whether v is in s. // contains reports whether v is in s.
func contains(s []string, v string) bool { func contains(s []string, v string) bool {
for _, x := range s { for _, x := range s {
......
...@@ -163,10 +163,6 @@ func archrelocvariant(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, t int64) int64 ...@@ -163,10 +163,6 @@ func archrelocvariant(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, t int64) int64
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -180,18 +176,10 @@ func asmb(ctxt *ld.Link) { ...@@ -180,18 +176,10 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -209,33 +197,19 @@ func asmb2(ctxt *ld.Link) { ...@@ -209,33 +197,19 @@ func asmb2(ctxt *ld.Link) {
if !ctxt.IsELF { if !ctxt.IsELF {
ld.Errorf(nil, "unsupported executable format") ld.Errorf(nil, "unsupported executable format")
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen) symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound))) symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
ctxt.Out.SeekSet(int64(symo)) ctxt.Out.SeekSet(int64(symo))
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
ld.Elfemitreloc(ctxt) ld.Elfemitreloc(ctxt)
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -169,10 +169,6 @@ func archrelocvariant(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, t int64) int64 ...@@ -169,10 +169,6 @@ func archrelocvariant(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, t int64) int64
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -186,24 +182,14 @@ func asmb(ctxt *ld.Link) { ...@@ -186,24 +182,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -219,9 +205,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -219,9 +205,6 @@ func asmb2(ctxt *ld.Link) {
symo := uint32(0) symo := uint32(0)
if !*ld.FlagS { if !*ld.FlagS {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
...@@ -237,9 +220,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -237,9 +220,6 @@ func asmb2(ctxt *ld.Link) {
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
...@@ -262,9 +242,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -262,9 +242,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -1062,10 +1062,6 @@ func ensureglinkresolver(ctxt *ld.Link) *sym.Symbol { ...@@ -1062,10 +1062,6 @@ func ensureglinkresolver(ctxt *ld.Link) *sym.Symbol {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -1081,24 +1077,14 @@ func asmb(ctxt *ld.Link) { ...@@ -1081,24 +1077,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f relrodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -1114,9 +1100,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -1114,9 +1100,6 @@ func asmb2(ctxt *ld.Link) {
symo := uint32(0) symo := uint32(0)
if !*ld.FlagS { if !*ld.FlagS {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
...@@ -1135,9 +1118,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -1135,9 +1118,6 @@ func asmb2(ctxt *ld.Link) {
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
...@@ -1164,9 +1144,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -1164,9 +1144,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -503,10 +503,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) { ...@@ -503,10 +503,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -520,24 +516,14 @@ func asmb(ctxt *ld.Link) { ...@@ -520,24 +516,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -555,32 +541,19 @@ func asmb2(ctxt *ld.Link) { ...@@ -555,32 +541,19 @@ func asmb2(ctxt *ld.Link) {
if !ctxt.IsELF { if !ctxt.IsELF {
ld.Errorf(nil, "unsupported executable format") ld.Errorf(nil, "unsupported executable format")
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen) symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound))) symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
ctxt.Out.SeekSet(int64(symo)) ctxt.Out.SeekSet(int64(symo))
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
ld.Elfemitreloc(ctxt) ld.Elfemitreloc(ctxt)
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f header\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
...@@ -96,10 +96,6 @@ func asmb(ctxt *ld.Link) {} // dummy ...@@ -96,10 +96,6 @@ func asmb(ctxt *ld.Link) {} // dummy
// asmb writes the final WebAssembly module binary. // asmb writes the final WebAssembly module binary.
// Spec: https://webassembly.github.io/spec/core/binary/modules.html // Spec: https://webassembly.github.io/spec/core/binary/modules.html
func asmb2(ctxt *ld.Link) { func asmb2(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
types := []*wasmFuncType{ types := []*wasmFuncType{
// For normal Go functions, the single parameter is PC_B, // For normal Go functions, the single parameter is PC_B,
// the return value is // the return value is
......
...@@ -620,10 +620,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) { ...@@ -620,10 +620,6 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
} }
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ctxt.IsELF { if ctxt.IsELF {
ld.Asmbelfsetup() ld.Asmbelfsetup()
} }
...@@ -638,25 +634,14 @@ func asmb(ctxt *ld.Link) { ...@@ -638,25 +634,14 @@ func asmb(ctxt *ld.Link) {
} }
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f rodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
} }
if ld.Segrelrodata.Filelen > 0 { if ld.Segrelrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f relrodatblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segrelrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrelrodata.Vaddr), int64(ld.Segrelrodata.Filelen))
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f datblk\n", ld.Cputime())
}
ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff)) ctxt.Out.SeekSet(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -676,9 +661,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -676,9 +661,6 @@ func asmb2(ctxt *ld.Link) {
symo := uint32(0) symo := uint32(0)
if !*ld.FlagS { if !*ld.FlagS {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f sym\n", ld.Cputime())
}
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
...@@ -701,9 +683,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -701,9 +683,6 @@ func asmb2(ctxt *ld.Link) {
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
if ctxt.IsELF { if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
ld.Asmelfsym(ctxt) ld.Asmelfsym(ctxt)
ctxt.Out.Flush() ctxt.Out.Flush()
ctxt.Out.Write(ld.Elfstrdat) ctxt.Out.Write(ld.Elfstrdat)
...@@ -725,9 +704,7 @@ func asmb2(ctxt *ld.Link) { ...@@ -725,9 +704,7 @@ func asmb2(ctxt *ld.Link) {
} }
case objabi.Hwindows: case objabi.Hwindows:
if ctxt.Debugvlog != 0 { // Do nothing
ctxt.Logf("%5.2f dwarf\n", ld.Cputime())
}
case objabi.Hdarwin: case objabi.Hdarwin:
if ctxt.LinkMode == ld.LinkExternal { if ctxt.LinkMode == ld.LinkExternal {
...@@ -736,9 +713,6 @@ func asmb2(ctxt *ld.Link) { ...@@ -736,9 +713,6 @@ func asmb2(ctxt *ld.Link) {
} }
} }
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f headr\n", ld.Cputime())
}
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
switch ctxt.HeadType { switch ctxt.HeadType {
default: default:
......
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