setuintxx(s, r, v, 8);
}
-/*
static vlong
addaddrpcrelplus(Sym *s, Sym *t, int32 add)
{
r->add = add;
return i;
}
-*/
vlong
addaddrplus(Sym *s, Sym *t, int32 add)
//print("gcaddsym: %s %d %s\n", s->name, s->size, gotype->name);
adduintxx(gc, GC_CALL, PtrSize);
adduintxx(gc, off, PtrSize);
- addaddrplus(gc, decodetype_gc(gotype), 1*PtrSize);
+ addaddrpcrelplus(gc, decodetype_gc(gotype), 4*PtrSize);
} else {
//print("gcaddsym: %s %d <unknown type>\n", s->name, s->size);
for(a = -off&(PtrSize-1); a+PtrSize<=s->size; a+=PtrSize) {
// Stack push.
*stack_ptr-- = stack_top;
stack_top = (Frame){1, 0, stack_top.b + pc[1], pc+3 /*return address*/};
- pc = (uintptr*)pc[2]; // target of the CALL instruction
+ pc = (uintptr*)((byte*)pc + (uintptr)pc[2]); // target of the CALL instruction
continue;
case GC_MAP_PTR:
// Meaning of arguments:
// off Offset (in bytes) from the start of the current object
// objgc Pointer to GC info of an object
+// objgcrel Offset to GC info of an object
// len Length of an array
// elemsize Size (in bytes) of an element
// size Size (in bytes)
GC_APTR, // Pointer to an arbitrary object. Args: (off)
GC_ARRAY_START, // Start an array with a fixed length. Args: (off, len, elemsize)
GC_ARRAY_NEXT, // The next element of an array. Args: none
- GC_CALL, // Call a subroutine. Args: (off, objgc)
+ GC_CALL, // Call a subroutine. Args: (off, objgcrel)
GC_MAP_PTR, // Go map. Args: (off, MapType*)
GC_STRING, // Go string. Args: (off)
GC_EFACE, // interface{}. Args: (off)
static Func *func;
static int32 nfunc;
+extern byte reloffset[];
static byte **fname;
static int32 nfname;
}
f = &func[nfunc++];
f->name = runtime·gostringnocopy(sym->name);
- f->entry = sym->value;
+ f->entry = sym->value + (uint64)reloffset;
if(sym->symtype == 'L' || sym->symtype == 'l')
f->frame = -sizeof(uintptr);
break;