diff options
| author | Russ Cox <rsc@golang.org> | 2013-08-01 12:58:27 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-08-01 12:58:27 -0400 |
| commit | b99fa8155514d4a5dad366dde9be8ae76333e6a9 (patch) | |
| tree | b9b22e0c19b1bde4944b7013ec539bfdf0ea9f3e /src/cmd/ld/lib.c | |
| parent | c24e60eebb822c39523a894e7a46a70eccc270d4 (diff) | |
| download | go-b99fa8155514d4a5dad366dde9be8ae76333e6a9.tar.xz | |
cmd/ld: report pclntab, funcdata sizes in 6l -v output
Also move chatty recent additions to -v -v.
For what it's worth:
$ go build -o /dev/null -ldflags -v cmd/go
...
0.87 pclntab=1110836 bytes, funcdata total 69700 bytes
...
$
This broke the ELF builds last time because I tried to dedup
the funcdata in case the same funcdata was pointed at by
multiple functions. That doesn't currently happen, so I've
removed that test.
If we start doing bitmap coalescing we'll need to figure out
how to measure the size more carefully, but I think at that
point the bitmaps will be an extra indirection away from the
funcdata anyway, so the dedup I used before wouldn't help.
R=ken2
CC=golang-dev
https://golang.org/cl/12269043
Diffstat (limited to 'src/cmd/ld/lib.c')
| -rw-r--r-- | src/cmd/ld/lib.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 94446c3bbb..c5af7fed88 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -231,7 +231,7 @@ addlib(char *src, char *obj) if(p != nil) *p = '\0'; - if(debug['v']) + if(debug['v'] > 1) Bprint(&bso, "%5.2f addlib: %s %s pulls in %s\n", cputime(), obj, src, pname); addlibpath(src, obj, pname, name); @@ -330,7 +330,7 @@ loadlib(void) } for(i=0; i<libraryp; i++) { - if(debug['v']) + if(debug['v'] > 1) Bprint(&bso, "%5.2f autolib: %s (from %s)\n", cputime(), library[i].file, library[i].objref); iscgo |= strcmp(library[i].pkg, "runtime/cgo") == 0; objfile(library[i].file, library[i].pkg); @@ -433,7 +433,7 @@ objfile(char *file, char *pkg) pkg = smprint("%i", pkg); - if(debug['v']) + if(debug['v'] > 1) Bprint(&bso, "%5.2f ldobj: %s (%s)\n", cputime(), file, pkg); Bflush(&bso); f = Bopen(file, 0); @@ -2049,7 +2049,7 @@ genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*)) } } if(debug['v'] || debug['n']) - Bprint(&bso, "symsize = %ud\n", symsize); + Bprint(&bso, "%5.2f symsize = %ud\n", cputime(), symsize); Bflush(&bso); } @@ -2356,7 +2356,9 @@ pclntab(void) uint32 *havepc, *havefunc; Sym *ftab, *s; int32 npcdata, nfuncdata, off, end; + int64 funcdata_bytes; + funcdata_bytes = 0; ftab = lookup("pclntab", 0); ftab->type = SPCLNTAB; ftab->reachable = 1; @@ -2478,8 +2480,11 @@ pclntab(void) i = p->from.offset; if(p->to.type == D_CONST) setuintxx(ftab, off+PtrSize*i, p->to.offset, PtrSize); - else + else { + // TODO: Dedup. + funcdata_bytes += p->to.sym->size; setaddrplus(ftab, off+PtrSize*i, p->to.sym, p->to.offset); + } } } off += nfuncdata*PtrSize; @@ -2506,4 +2511,7 @@ pclntab(void) setuint32(ftab, start + s->value*4, ftabaddstring(ftab, s->name)); ftab->size = ftab->np; + + if(debug['v']) + Bprint(&bso, "%5.2f pclntab=%lld bytes, funcdata total %lld bytes\n", cputime(), (vlong)ftab->size, (vlong)funcdata_bytes); } |
