ref: a2ad59b340bf3339dbba105310002474b98d0184
parent: 8287e0cd29d9afdb41efa029705644f8427cf53a
author: kws <kws@cirno>
date: Tue Jan 2 21:14:53 EST 2024
libmach: handle VCONST
--- a/sys/src/libmach/zobj.c
+++ b/sys/src/libmach/zobj.c
@@ -81,7 +81,8 @@
addr(Biobuf *bp)
{
Addr a;
- long off;
+ vlong off;
+ long l;
a.type = Bgetc(bp); /* a.type */
skip(bp,1); /* reg */
@@ -98,10 +99,20 @@
case D_OREG:
case D_CONST:
case D_BRANCH:
- off = Bgetc(bp);
- off |= Bgetc(bp) << 8;
- off |= Bgetc(bp) << 16;
- off |= Bgetc(bp) << 24;
+ case D_VCONST:
+ l = Bgetc(bp);
+ l |= Bgetc(bp) << 8;
+ l |= Bgetc(bp) << 16;
+ l |= Bgetc(bp) << 24;
+ off = l;
+ if(a.type == D_VCONST){
+ l = Bgetc(bp);
+ l |= Bgetc(bp) << 8;
+ l |= Bgetc(bp) << 16;
+ l |= Bgetc(bp) << 24;
+ off = ((vlong)l << 32) | (off & 0xFFFFFFFF);
+ a.type = D_CONST; /* perhaps */
+ }
if(off < 0)
off = -off;
if(a.sym && (a.name==D_PARAM || a.name==D_AUTO))