Skip to content

Commit 64f5023

Browse files
committed
cmd/link: remove global Bso variable
Bso is already a member on ld.Link. Use that instead of the global. Updates #16818 Change-Id: Icfc0f6cb1ff551e8129253fb6b5e0d6a94479f51 Reviewed-on: https://go-review.googlesource.com/27470 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 1756b66 commit 64f5023

File tree

15 files changed

+150
-154
lines changed

15 files changed

+150
-154
lines changed

src/cmd/link/internal/amd64/asm.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -600,14 +600,14 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
600600

601601
func asmb(ctxt *ld.Link) {
602602
if ld.Debug['v'] != 0 {
603-
fmt.Fprintf(ld.Bso, "%5.2f asmb\n", obj.Cputime())
603+
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
604604
}
605-
ld.Bso.Flush()
605+
ctxt.Bso.Flush()
606606

607607
if ld.Debug['v'] != 0 {
608-
fmt.Fprintf(ld.Bso, "%5.2f codeblk\n", obj.Cputime())
608+
fmt.Fprintf(ctxt.Bso, "%5.2f codeblk\n", obj.Cputime())
609609
}
610-
ld.Bso.Flush()
610+
ctxt.Bso.Flush()
611611

612612
if ld.Iself {
613613
ld.Asmbelfsetup(ctxt)
@@ -624,18 +624,18 @@ func asmb(ctxt *ld.Link) {
624624

625625
if ld.Segrodata.Filelen > 0 {
626626
if ld.Debug['v'] != 0 {
627-
fmt.Fprintf(ld.Bso, "%5.2f rodatblk\n", obj.Cputime())
627+
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
628628
}
629-
ld.Bso.Flush()
629+
ctxt.Bso.Flush()
630630

631631
ld.Cseek(int64(ld.Segrodata.Fileoff))
632632
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
633633
}
634634

635635
if ld.Debug['v'] != 0 {
636-
fmt.Fprintf(ld.Bso, "%5.2f datblk\n", obj.Cputime())
636+
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
637637
}
638-
ld.Bso.Flush()
638+
ctxt.Bso.Flush()
639639

640640
ld.Cseek(int64(ld.Segdata.Fileoff))
641641
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
@@ -678,9 +678,9 @@ func asmb(ctxt *ld.Link) {
678678
symo := int64(0)
679679
if ld.Debug['s'] == 0 {
680680
if ld.Debug['v'] != 0 {
681-
fmt.Fprintf(ld.Bso, "%5.2f sym\n", obj.Cputime())
681+
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
682682
}
683-
ld.Bso.Flush()
683+
ctxt.Bso.Flush()
684684
switch ld.HEADTYPE {
685685
default:
686686
case obj.Hplan9:
@@ -715,7 +715,7 @@ func asmb(ctxt *ld.Link) {
715715
ld.Cwrite(ld.Elfstrdat)
716716

717717
if ld.Debug['v'] != 0 {
718-
fmt.Fprintf(ld.Bso, "%5.2f dwarf\n", obj.Cputime())
718+
fmt.Fprintf(ctxt.Bso, "%5.2f dwarf\n", obj.Cputime())
719719
}
720720

721721
if ld.Linkmode == ld.LinkExternal {
@@ -739,7 +739,7 @@ func asmb(ctxt *ld.Link) {
739739

740740
case obj.Hwindows:
741741
if ld.Debug['v'] != 0 {
742-
fmt.Fprintf(ld.Bso, "%5.2f dwarf\n", obj.Cputime())
742+
fmt.Fprintf(ctxt.Bso, "%5.2f dwarf\n", obj.Cputime())
743743
}
744744

745745
case obj.Hdarwin:
@@ -750,9 +750,9 @@ func asmb(ctxt *ld.Link) {
750750
}
751751

752752
if ld.Debug['v'] != 0 {
753-
fmt.Fprintf(ld.Bso, "%5.2f headr\n", obj.Cputime())
753+
fmt.Fprintf(ctxt.Bso, "%5.2f headr\n", obj.Cputime())
754754
}
755-
ld.Bso.Flush()
755+
ctxt.Bso.Flush()
756756
ld.Cseek(0)
757757
switch ld.HEADTYPE {
758758
default:

src/cmd/link/internal/arm/asm.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,9 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
583583

584584
func asmb(ctxt *ld.Link) {
585585
if ld.Debug['v'] != 0 {
586-
fmt.Fprintf(ld.Bso, "%5.2f asmb\n", obj.Cputime())
586+
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
587587
}
588-
ld.Bso.Flush()
588+
ctxt.Bso.Flush()
589589

590590
if ld.Iself {
591591
ld.Asmbelfsetup(ctxt)
@@ -601,18 +601,18 @@ func asmb(ctxt *ld.Link) {
601601

602602
if ld.Segrodata.Filelen > 0 {
603603
if ld.Debug['v'] != 0 {
604-
fmt.Fprintf(ld.Bso, "%5.2f rodatblk\n", obj.Cputime())
604+
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
605605
}
606-
ld.Bso.Flush()
606+
ctxt.Bso.Flush()
607607

608608
ld.Cseek(int64(ld.Segrodata.Fileoff))
609609
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
610610
}
611611

612612
if ld.Debug['v'] != 0 {
613-
fmt.Fprintf(ld.Bso, "%5.2f datblk\n", obj.Cputime())
613+
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
614614
}
615-
ld.Bso.Flush()
615+
ctxt.Bso.Flush()
616616

617617
ld.Cseek(int64(ld.Segdata.Fileoff))
618618
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
@@ -633,9 +633,9 @@ func asmb(ctxt *ld.Link) {
633633
if ld.Debug['s'] == 0 {
634634
// TODO: rationalize
635635
if ld.Debug['v'] != 0 {
636-
fmt.Fprintf(ld.Bso, "%5.2f sym\n", obj.Cputime())
636+
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
637637
}
638-
ld.Bso.Flush()
638+
ctxt.Bso.Flush()
639639
switch ld.HEADTYPE {
640640
default:
641641
if ld.Iself {
@@ -655,7 +655,7 @@ func asmb(ctxt *ld.Link) {
655655
default:
656656
if ld.Iself {
657657
if ld.Debug['v'] != 0 {
658-
fmt.Fprintf(ld.Bso, "%5.2f elfsym\n", obj.Cputime())
658+
fmt.Fprintf(ctxt.Bso, "%5.2f elfsym\n", obj.Cputime())
659659
}
660660
ld.Asmelfsym(ctxt)
661661
ld.Cflush()
@@ -689,9 +689,9 @@ func asmb(ctxt *ld.Link) {
689689

690690
ctxt.Cursym = nil
691691
if ld.Debug['v'] != 0 {
692-
fmt.Fprintf(ld.Bso, "%5.2f header\n", obj.Cputime())
692+
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
693693
}
694-
ld.Bso.Flush()
694+
ctxt.Bso.Flush()
695695
ld.Cseek(0)
696696
switch ld.HEADTYPE {
697697
default:

src/cmd/link/internal/arm64/asm.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ func archrelocvariant(ctxt *ld.Link, r *ld.Reloc, s *ld.Symbol, t int64) int64 {
392392

393393
func asmb(ctxt *ld.Link) {
394394
if ld.Debug['v'] != 0 {
395-
fmt.Fprintf(ld.Bso, "%5.2f asmb\n", obj.Cputime())
395+
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
396396
}
397-
ld.Bso.Flush()
397+
ctxt.Bso.Flush()
398398

399399
if ld.Iself {
400400
ld.Asmbelfsetup(ctxt)
@@ -410,18 +410,18 @@ func asmb(ctxt *ld.Link) {
410410

411411
if ld.Segrodata.Filelen > 0 {
412412
if ld.Debug['v'] != 0 {
413-
fmt.Fprintf(ld.Bso, "%5.2f rodatblk\n", obj.Cputime())
413+
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
414414
}
415-
ld.Bso.Flush()
415+
ctxt.Bso.Flush()
416416

417417
ld.Cseek(int64(ld.Segrodata.Fileoff))
418418
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
419419
}
420420

421421
if ld.Debug['v'] != 0 {
422-
fmt.Fprintf(ld.Bso, "%5.2f datblk\n", obj.Cputime())
422+
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
423423
}
424-
ld.Bso.Flush()
424+
ctxt.Bso.Flush()
425425

426426
ld.Cseek(int64(ld.Segdata.Fileoff))
427427
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
@@ -442,9 +442,9 @@ func asmb(ctxt *ld.Link) {
442442
if ld.Debug['s'] == 0 {
443443
// TODO: rationalize
444444
if ld.Debug['v'] != 0 {
445-
fmt.Fprintf(ld.Bso, "%5.2f sym\n", obj.Cputime())
445+
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
446446
}
447-
ld.Bso.Flush()
447+
ctxt.Bso.Flush()
448448
switch ld.HEADTYPE {
449449
default:
450450
if ld.Iself {
@@ -464,7 +464,7 @@ func asmb(ctxt *ld.Link) {
464464
default:
465465
if ld.Iself {
466466
if ld.Debug['v'] != 0 {
467-
fmt.Fprintf(ld.Bso, "%5.2f elfsym\n", obj.Cputime())
467+
fmt.Fprintf(ctxt.Bso, "%5.2f elfsym\n", obj.Cputime())
468468
}
469469
ld.Asmelfsym(ctxt)
470470
ld.Cflush()
@@ -498,9 +498,9 @@ func asmb(ctxt *ld.Link) {
498498

499499
ctxt.Cursym = nil
500500
if ld.Debug['v'] != 0 {
501-
fmt.Fprintf(ld.Bso, "%5.2f header\n", obj.Cputime())
501+
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
502502
}
503-
ld.Bso.Flush()
503+
ctxt.Bso.Flush()
504504
ld.Cseek(0)
505505
switch ld.HEADTYPE {
506506
default:

src/cmd/link/internal/ld/ar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func hostArchive(ctxt *Link, name string) {
6969
if os.IsNotExist(err) {
7070
// It's OK if we don't have a libgcc file at all.
7171
if Debug['v'] != 0 {
72-
fmt.Fprintf(Bso, "skipping libgcc file: %v\n", err)
72+
fmt.Fprintf(ctxt.Bso, "skipping libgcc file: %v\n", err)
7373
}
7474
return
7575
}

src/cmd/link/internal/ld/data.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,9 @@ func relocsym(ctxt *Link, s *Symbol) {
653653

654654
func (ctxt *Link) reloc() {
655655
if Debug['v'] != 0 {
656-
fmt.Fprintf(Bso, "%5.2f reloc\n", obj.Cputime())
656+
fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime())
657657
}
658-
Bso.Flush()
658+
ctxt.Bso.Flush()
659659

660660
for _, s := range ctxt.Textp {
661661
relocsym(ctxt, s)
@@ -729,9 +729,9 @@ func dynreloc(ctxt *Link, data *[obj.SXREF][]*Symbol) {
729729
return
730730
}
731731
if Debug['v'] != 0 {
732-
fmt.Fprintf(Bso, "%5.2f reloc\n", obj.Cputime())
732+
fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime())
733733
}
734-
Bso.Flush()
734+
ctxt.Bso.Flush()
735735

736736
for _, s := range ctxt.Textp {
737737
dynrelocsym(ctxt, s)
@@ -800,7 +800,7 @@ func Codeblk(ctxt *Link, addr int64, size int64) {
800800
}
801801
func CodeblkPad(ctxt *Link, addr int64, size int64, pad []byte) {
802802
if Debug['a'] != 0 {
803-
fmt.Fprintf(Bso, "codeblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
803+
fmt.Fprintf(ctxt.Bso, "codeblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
804804
}
805805

806806
blkSlice(ctxt, ctxt.Textp, addr, size, pad)
@@ -832,36 +832,36 @@ func CodeblkPad(ctxt *Link, addr int64, size int64, pad []byte) {
832832
}
833833

834834
if addr < sym.Value {
835-
fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
835+
fmt.Fprintf(ctxt.Bso, "%-20s %.8x|", "_", uint64(addr))
836836
for ; addr < sym.Value; addr++ {
837-
fmt.Fprintf(Bso, " %.2x", 0)
837+
fmt.Fprintf(ctxt.Bso, " %.2x", 0)
838838
}
839-
fmt.Fprintf(Bso, "\n")
839+
fmt.Fprintf(ctxt.Bso, "\n")
840840
}
841841

842-
fmt.Fprintf(Bso, "%.6x\t%-20s\n", uint64(addr), sym.Name)
842+
fmt.Fprintf(ctxt.Bso, "%.6x\t%-20s\n", uint64(addr), sym.Name)
843843
q = sym.P
844844

845845
for len(q) >= 16 {
846-
fmt.Fprintf(Bso, "%.6x\t% x\n", uint64(addr), q[:16])
846+
fmt.Fprintf(ctxt.Bso, "%.6x\t% x\n", uint64(addr), q[:16])
847847
addr += 16
848848
q = q[16:]
849849
}
850850

851851
if len(q) > 0 {
852-
fmt.Fprintf(Bso, "%.6x\t% x\n", uint64(addr), q)
852+
fmt.Fprintf(ctxt.Bso, "%.6x\t% x\n", uint64(addr), q)
853853
addr += int64(len(q))
854854
}
855855
}
856856

857857
if addr < eaddr {
858-
fmt.Fprintf(Bso, "%-20s %.8x|", "_", uint64(addr))
858+
fmt.Fprintf(ctxt.Bso, "%-20s %.8x|", "_", uint64(addr))
859859
for ; addr < eaddr; addr++ {
860-
fmt.Fprintf(Bso, " %.2x", 0)
860+
fmt.Fprintf(ctxt.Bso, " %.2x", 0)
861861
}
862862
}
863863

864-
Bso.Flush()
864+
ctxt.Bso.Flush()
865865
}
866866

867867
// blkSlice is a variant of blk that processes slices.
@@ -915,7 +915,7 @@ func blkSlice(ctxt *Link, syms []*Symbol, addr, size int64, pad []byte) {
915915

916916
func Datblk(ctxt *Link, addr int64, size int64) {
917917
if Debug['a'] != 0 {
918-
fmt.Fprintf(Bso, "datblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
918+
fmt.Fprintf(ctxt.Bso, "datblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
919919
}
920920

921921
blkSlice(ctxt, datap, addr, size, zeros[:])
@@ -939,23 +939,23 @@ func Datblk(ctxt *Link, addr int64, size int64) {
939939
break
940940
}
941941
if addr < sym.Value {
942-
fmt.Fprintf(Bso, "\t%.8x| 00 ...\n", uint64(addr))
942+
fmt.Fprintf(ctxt.Bso, "\t%.8x| 00 ...\n", uint64(addr))
943943
addr = sym.Value
944944
}
945945

946-
fmt.Fprintf(Bso, "%s\n\t%.8x|", sym.Name, uint64(addr))
946+
fmt.Fprintf(ctxt.Bso, "%s\n\t%.8x|", sym.Name, uint64(addr))
947947
for i, b := range sym.P {
948948
if i > 0 && i%16 == 0 {
949-
fmt.Fprintf(Bso, "\n\t%.8x|", uint64(addr)+uint64(i))
949+
fmt.Fprintf(ctxt.Bso, "\n\t%.8x|", uint64(addr)+uint64(i))
950950
}
951-
fmt.Fprintf(Bso, " %.2x", b)
951+
fmt.Fprintf(ctxt.Bso, " %.2x", b)
952952
}
953953

954954
addr += int64(len(sym.P))
955955
for ; addr < sym.Value+sym.Size; addr++ {
956-
fmt.Fprintf(Bso, " %.2x", 0)
956+
fmt.Fprintf(ctxt.Bso, " %.2x", 0)
957957
}
958-
fmt.Fprintf(Bso, "\n")
958+
fmt.Fprintf(ctxt.Bso, "\n")
959959

960960
if Linkmode != LinkExternal {
961961
continue
@@ -974,19 +974,19 @@ func Datblk(ctxt *Link, addr int64, size int64) {
974974
case obj.R_CALL:
975975
typ = "call"
976976
}
977-
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)
977+
fmt.Fprintf(ctxt.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)
978978
}
979979
}
980980

981981
if addr < eaddr {
982-
fmt.Fprintf(Bso, "\t%.8x| 00 ...\n", uint(addr))
982+
fmt.Fprintf(ctxt.Bso, "\t%.8x| 00 ...\n", uint(addr))
983983
}
984-
fmt.Fprintf(Bso, "\t%.8x|\n", uint(eaddr))
984+
fmt.Fprintf(ctxt.Bso, "\t%.8x|\n", uint(eaddr))
985985
}
986986

987987
func Dwarfblk(ctxt *Link, addr int64, size int64) {
988988
if Debug['a'] != 0 {
989-
fmt.Fprintf(Bso, "dwarfblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
989+
fmt.Fprintf(ctxt.Bso, "dwarfblk [%#x,%#x) at offset %#x\n", addr, addr+size, Cpos())
990990
}
991991

992992
blk(ctxt, dwarfp, addr, size)
@@ -1255,9 +1255,9 @@ var datap []*Symbol
12551255

12561256
func (ctxt *Link) dodata() {
12571257
if Debug['v'] != 0 {
1258-
fmt.Fprintf(Bso, "%5.2f dodata\n", obj.Cputime())
1258+
fmt.Fprintf(ctxt.Bso, "%5.2f dodata\n", obj.Cputime())
12591259
}
1260-
Bso.Flush()
1260+
ctxt.Bso.Flush()
12611261

12621262
// Collect data symbols by type into data.
12631263
var data [obj.SXREF][]*Symbol

src/cmd/link/internal/ld/dwarf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ func dwarfgeneratedebugsyms(ctxt *Link) {
14151415
}
14161416

14171417
if Debug['v'] != 0 {
1418-
fmt.Fprintf(Bso, "%5.2f dwarf\n", obj.Cputime())
1418+
fmt.Fprintf(ctxt.Bso, "%5.2f dwarf\n", obj.Cputime())
14191419
}
14201420

14211421
// Forctxt.Diagnostic messages.

0 commit comments

Comments
 (0)