Not included in output file
A community discussion post from the original code:zIRON forum.
Replies
// not included because not used
dword d1 = 0x12345678;
// not included BUT used
dword d1 = 0x12345678;
eax = 0;
eax = [eax + @d1];
// included BUT NOT used(only address used, not value)
dword d1 = 0x12345678;
eax = @d1;
What would can be recommended?
first way: add extra option for this
second way: use option #optimise for this
third way: always include all data
As for third way then it similar to usual behavior of many other assemblers.
Just compare:
Ziron:
dword MyVariable = 0x12345678;
MyVariable; // <<-- this also need to write
Other:
MyVariable dd 0x12345678 // <<-- that's all enough!
It may be hard to determine is value used or not.
For example if programmer already knows address. He can use direct address.
Anyway such assembler restrictions not so useable. I think that programmer would like more easy way without extra actions.
Second code, I will correct, this was a small overlook, I forgot to set var as used. I will also add directive to always write data.
Of course using vars to write data is not the norm....
Asm
MyVariable dd 0x12345678
Ziron
emit dword 0x12345678;
OK, I have corrected [@d] setting variable active and I have also added a new directive "awd" - always write data.
program RAW_IMAGE 'test';
#set bits 32;
#set awd true;
byte b1[] = 'Hello World!';
Optimizations on high level ofcourse very useful. But not on LOW level.
i.e. for example
mov al, al
Because programmer wrote it not just for fun. Therefore he need it.
May be you also will remove
xchg eax, eax; (NOP)
?
My point -- optimizations need only on high level.
I have fixed this.
eax = eax;
will be optimised by default
mov eax, eax
will be output as written.
Here is 'dword d1' not included in output mscoff file:
program MSCOFF 'test';
#set bits 32;
dword d1 = 1;
d1;
But here is included:
program MSCOFF 'test';
#set bits 32;
dword d1 = 1;
eax = d1;
Also seems there are unnecessary
_GetProcessHeap@0
__smm_hHeap