I caught a problem on re-asselembling the disassembly.
I want byte pattern of re-assembled binary to be same with original binary.
However, It wasn't. I'll show you an example.
(I know encoding problem regarding displacement
can be handled using Here.
But this problem is about immediate value
, not displacement
)
1.disassembly of binary_A was :
83 2f 55 subl $0x55,(%edi)
81 2f 55 00 00 00 subl $0x55,(%edi)
2.parsed 1
and made A.s
file:
subl $0x55,(%edi)
subl $0x55,(%edi)
3.re-assembled A.s
.
83 2f 55 subl $0x55,(%edi)
83 2f 55 subl $0x55,(%edi)
As you see, byte pattern of re-assembled binary and original binary is different!
Actually, in my opinion, disassembled code in step 1
shouldn't be the same.
Because encoding of immediate value(0x55
)is different each other!(55 00 00 00
and 55
).
How can I enforce the assembler to emit the exact machine code that I want?
Especially, I want subl $0x55,(%edi)
to be assembled as 81 2f 55 00 00 00
.
Is there any way to do this?