Really poor code quality
Frago9876543210 opened this issue · comments
E:\demos>ml64 cleaned_file.asm /link /entry:main
Microsoft (R) Macro Assembler (x64) Version 14.29.30138.0
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: cleaned_file.asm
cleaned_file.asm(109) : error A2075:jump destination too far : by 41 byte(s)
Please read the message printed by masm_shc
during the conversion. It informs that changing the jumps is required, and this part is currently not automated in the tool, so it has to be done manually:
[INFO] Entry Point: AlignRSP
[INFO] Strings have been inlined. It may require to change some short jumps (jmp SHORT) into jumps (jmp)
It exactly references to the line you mentioned:
cleaned_file.asm(109) : error A2075:jump destination too far : by 41 byte(s)
So you need to change it from:
jmp SHORT $LN1@main
to:
jmp $LN1@main
it was described in the paper.
Another thing that you missed by not reading the messages is, the Entry Point of 64-bit module should not be main
, but AlignRSP
- this is the added stub that prepares the alignment before the main can be run. In basic cases like this it does not make a much difference, but in other cases the app may crash if you omit this stub.
[INFO] Entry Point: AlignRSP
So it should be:
E:\demos>ml64 cleaned_file.asm /link /entry:AlignRSP