Skip to content

Commit cc44642

Browse files
author
Mike Pall
committed
Merge branch 'master' into v2.1
2 parents 7e94e1c + 412d5a4 commit cc44642

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dynasm/dasm_x86.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,13 @@ int dasm_link(Dst_DECL, size_t *szp)
305305

306306
while (pos != lastpos) {
307307
dasm_ActList p = D->actionlist + b[pos++];
308+
int op = 0;
308309
while (1) {
309-
int op, action = *p++;
310+
int action = *p++;
310311
switch (action) {
311-
case DASM_REL_LG: p++; op = p[-3]; goto rel_pc;
312-
case DASM_REL_PC: op = p[-2]; rel_pc: {
312+
case DASM_REL_LG: p++;
313+
/* fallthrough */
314+
case DASM_REL_PC: {
313315
int shrink = op == 0xe9 ? 3 : ((op&0xf0) == 0x80 ? 4 : 0);
314316
if (shrink) { /* Shrinkable branch opcode? */
315317
int lofs, lpos = b[pos];
@@ -341,9 +343,10 @@ int dasm_link(Dst_DECL, size_t *szp)
341343
case DASM_LABEL_PC: b[pos++] += ofs; break; /* Fix label offset. */
342344
case DASM_ALIGN: ofs -= (b[pos++]+ofs)&*p++; break; /* Adjust ofs. */
343345
case DASM_EXTERN: p += 2; break;
344-
case DASM_ESC: p++; break;
346+
case DASM_ESC: op = *p++; break;
345347
case DASM_MARK: break;
346348
case DASM_SECTION: case DASM_STOP: goto stop;
349+
default: op = action; break;
347350
}
348351
}
349352
stop: (void)0;

0 commit comments

Comments
 (0)