shithub: riscv

Download patch

ref: 69e37c0fdaafb678d12df9ccfabbc47104e57d73
parent: 93837692bbaab28e01ea1178d8867047bbcad11d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu May 18 18:12:11 EDT 2023

libmach: fix reading .7 objects containing instructions with an extra register (from3)

--- a/sys/src/libmach/7obj.c
+++ b/sys/src/libmach/7obj.c
@@ -70,8 +70,11 @@
 		p->kind = aText;
 	else if(as == AGLOBL)
 		p->kind = aData;
-	skip(bp, 5);		/* reg(1) lineno(4) */
+	n = (uchar)Bgetc(bp);	/* reg and flag (1) */
+	skip(bp, 4);		/* lineno(4) */
 	a = addr(bp);
+	if(n & 0x40)
+		addr(bp);	/* from3 */
 	addr(bp);
 	if(a.type != D_OREG || a.name != D_STATIC && a.name != D_EXTERN)
 		p->kind = aNone;