Skip to content

Commit 4123725

Browse files
committed
Added early return for invalid prefix
1 parent 7b494f4 commit 4123725

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lld/ELF/Arch/X86_64.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,11 @@ void X86_64::relaxTlsIeToLe(uint8_t *loc, const Relocation &rel,
589589
<< "R_X86_64_GOTTPOFF must be used in MOVQ or ADDQ instructions only";
590590
}
591591
} else if (rel.type == R_X86_64_CODE_4_GOTTPOFF) {
592-
if (loc[-4] != 0xd5)
592+
if (loc[-4] != 0xd5) {
593593
Err(ctx) << getErrorLoc(ctx, loc - 4)
594594
<< "Invalid prefix with R_X86_64_CODE_4_GOTTPOFF!";
595+
return;
596+
}
595597
const uint8_t rex = loc[-3];
596598
loc[-3] = (rex & ~0x44) | (rex & 0x44) >> 2;
597599
*regSlot = 0xc0 | reg;

0 commit comments

Comments
 (0)