diff options
Diffstat (limited to 'src/libmach_amd64/sym.c')
-rw-r--r-- | src/libmach_amd64/sym.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/libmach_amd64/sym.c b/src/libmach_amd64/sym.c index 0e545a1f3..13bc608fc 100644 --- a/src/libmach_amd64/sym.c +++ b/src/libmach_amd64/sym.c @@ -87,7 +87,6 @@ static uvlong firstinstr; /* as found from symtab; needed for amd64 */ static void cleansyms(void); static int32 decodename(Biobuf*, Sym*); -static int32 decodegotype(Biobuf*, Sym*); static short *encfname(char*); static int fline(char*, int, int32, Hist*, Hist**); static void fillsym(Sym*, Symbol*); @@ -152,10 +151,18 @@ syminit(int fd, Fhdr *fp) if(i < 0) return -1; size += i+svalsz+sizeof(p->type); - i = decodegotype(&b, p); - if(i < 0) - return -1; - size += i; + + if(svalsz == 8){ + if(Bread(&b, &vl, 8) != 8) + return symerrmsg(8, "symbol"); + p->gotype = beswav(vl); + } + else{ + if(Bread(&b, &l, 4) != 4) + return symerrmsg(4, "symbol"); + p->gotype = (u32int)beswal(l); + } + size += svalsz; /* count global & auto vars, text symbols, and file names */ switch (p->type) { @@ -298,27 +305,6 @@ decodename(Biobuf *bp, Sym *p) return n; } -static int32 -decodegotype(Biobuf *bp, Sym *p) -{ - char *cp; - int32 n; - - cp = Brdline(bp, '\0'); - if(cp == 0) { - werrstr("can't read go type"); - return -1; - } - n = Blinelen(bp); - p->gotype = malloc(n); - if(p->gotype == 0) { - werrstr("can't malloc %ld bytes", n); - return -1; - } - strcpy(p->gotype, cp); - return n; -} - /* * free any previously loaded symbol tables */ |