summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/symtab.c')
-rw-r--r--src/pkg/runtime/symtab.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/pkg/runtime/symtab.c b/src/pkg/runtime/symtab.c
index 9e69ab4bf..b571d21ec 100644
--- a/src/pkg/runtime/symtab.c
+++ b/src/pkg/runtime/symtab.c
@@ -15,6 +15,7 @@
#include "runtime.h"
#include "defs.h"
#include "os.h"
+#include "arch.h"
// TODO(rsc): Move this *under* the text segment.
// Then define names for these addresses instead of hard-coding magic ones.
@@ -102,6 +103,8 @@ dofunc(Sym *sym)
switch(sym->symtype) {
case 't':
case 'T':
+ case 'l':
+ case 'L':
if(strcmp(sym->name, (byte*)"etext") == 0)
break;
if(func == nil) {
@@ -111,10 +114,12 @@ dofunc(Sym *sym)
f = &func[nfunc++];
f->name = gostring(sym->name);
f->entry = sym->value;
+ if(sym->symtype == 'L' || sym->symtype == 'l')
+ f->frame = -sizeof(uintptr);
break;
case 'm':
if(nfunc > 0 && func != nil)
- func[nfunc-1].frame = sym->value;
+ func[nfunc-1].frame += sym->value;
break;
case 'p':
if(nfunc > 0 && func != nil) {
@@ -233,8 +238,6 @@ dosrcline(Sym *sym)
}
}
-enum { PcQuant = 1 };
-
// Interpret pc/ln table, saving the subpiece for each func.
static void
splitpcln(void)
@@ -244,6 +247,16 @@ splitpcln(void)
byte *p, *ep;
Func *f, *ef;
int32 *v;
+ int32 pcquant;
+
+ switch(thechar) {
+ case '5':
+ pcquant = 4;
+ break;
+ default: // 6, 8
+ pcquant = 1;
+ break;
+ }
// TODO(rsc): Remove once TODO at top of file is done.
if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
@@ -266,7 +279,7 @@ splitpcln(void)
ef = func + nfunc;
pc = func[0].entry; // text base
f->pcln.array = p;
- f->pc0 = pc - PcQuant;
+ f->pc0 = pc - pcquant;
line = 0;
for(; p < ep; p++) {
if(f < ef && pc > (f+1)->entry) {
@@ -286,9 +299,9 @@ splitpcln(void)
} else if(*p <= 128) {
line -= *p - 64;
} else {
- pc += PcQuant*(*p - 129);
+ pc += pcquant*(*p - 129);
}
- pc += PcQuant;
+ pc += pcquant;
}
if(f < ef) {
f->pcln.len = p - f->pcln.array;
@@ -306,6 +319,16 @@ funcline(Func *f, uint64 targetpc)
byte *p, *ep;
uintptr pc;
int32 line;
+ int32 pcquant;
+
+ switch(thechar) {
+ case '5':
+ pcquant = 4;
+ break;
+ default: // 6, 8
+ pcquant = 1;
+ break;
+ }
p = f->pcln.array;
ep = p + f->pcln.len;
@@ -320,9 +343,9 @@ funcline(Func *f, uint64 targetpc)
} else if(*p <= 128) {
line -= *p - 64;
} else {
- pc += PcQuant*(*p - 129);
+ pc += pcquant*(*p - 129);
}
- pc += PcQuant;
+ pc += pcquant;
}
return line;
}