diff options
| author | Michael Forney <[email protected]> | 2021-10-19 13:47:31 -0700 |
|---|---|---|
| committer | Michael Forney <[email protected]> | 2021-10-19 13:47:31 -0700 |
| commit | 936dd9a97e454747f8783fda8f1ee0c13d3f991d (patch) | |
| tree | 9f1ee66b217ba71e04d5ee4c4800e13addfbe629 /main.c | |
| parent | aa8a1c835b392023d2551257ee02951e43ee27db (diff) | |
Consider change in instruction size when calculating jump distance.
If we previously used a 4-byte offset, the instruction is 4 bytes
larger than if we were to use a 1 byte offset. Therefore, an
instruction whose previous offset was 0x83 should still be eligible
for 1 byte encoding.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -503,7 +503,7 @@ assemblejmp(const Jmp* j) } else { distance = target->wco - cursection->hdr.sh_size; } - if ((distance - 1) >= -128 && (distance - 1) <= 127) { + if ((distance - 1) >= -128 && (distance - 5) <= 127) { jmpsize = 1; } else { jmpsize = 4; |
